This is a basic backend service to support a messaging web app. It has REST API endpoints for certain functions and offers real-time message support with Socket.IO.
This backend service was made to support the web app that was made alongside it. You can find the codebase for that project here. In addition, this project requires a running PostgreSQL database, the setup of which can be found here.
| Name | Description | Example |
|---|---|---|
| PGUSER | The user for the PostgreSQL database. | user |
| PGHOST | The host name for the database. | localhost |
| PGDATABASE | The database name. | messages_db |
| PGPASSWORD | The password for the user of the database. | password1 |
| PGPORT | The port for the database. | 5432 |
| PORT | The port which the application runs. | 8000 |
| TOKEN_SECRET | JWT signing secret. | secretsecret |
| APP_BASE_URL | Frontend application URL for password reset links. | https://your.site |
| BASE_URL | Backend application URL for the image base URL links. | https://api.your.site |
| VERIFY_USERS | Set to 'true' to enable email verification. | true |
| SEND_EMAILS | Set to 'true' to enable any email sending. | true |
| ENABLE_UPLOADS | Set to 'true' to enable image uploads. | true |
| SENDGRID_API_KEY | API key to authenticate with SendGrid | apikey |
| NODE_ENV | Set to 'test' to enable additional logging. | test |
- Ensure Node.js is installed on your machine.
- Run
npm installin this directory to install dependencies. - Run
npm run devto run in a development environment.
- Ensure Node.js is installed on your machine.
- Run
npm installin this directory. - Run
npm run buildto build a production application. - Run
npm startto serve the production application.
You can run this in a production context in a Docker container.
docker build -t messages-service .
docker run -p 8000:8000 --env-file .env web-messages-service