This server is based on Node.js app using Express 4. It is intended to be hosted on the Heroku platform.
For more information about using Node.js on Heroku, see these Dev Center articles:
- Getting Started on Heroku with Node.js
- Heroku Node.js Support
- Node.js on Heroku
- Best Practices for Node.js Development
- Using WebSockets on Heroku with Node.js
- Node.js, Express.js, and PostgreSQL: CRUD REST API example
- How to use CORS in Node.js with Express
- Send a JSON response using Express
- json2csv
Initial creation of app (needed once to create a new Heroku app):
$ heroku create
$ git push heroku main
$ heroku open
Further updates like this:
git add .
git commit -m "update"
git push heroku main
heroku ps:scale web=0 # scale down
heroku ps:scale web=1 # scale up
heroku pg:psql # edit database
Make sure you have Node.js and the Heroku CLI installed. You should create a local .env file to set development mode:
$ heroku config:get ENV -s >> .env
Edit .env
file and set ENV=development
to develop locally. Add the address to your local PostgresSQL database LOCAL_DB=postgresql://localhost:5432/kammer
. You can now log from any app running on http://localhost:4200.
$ npm install
$ npm start
$ heroko local
Your app should now be running on localhost:5000.
- GET
'/'
The app has one main route to display information. - GET
'/db'
Displays information about log entries - GET
/export
Exports logging data as CSV file - GET
/cool
See for yourself - POST
/log
Provide logging information via JSON