Backend: Projects restarts on save

This commit is contained in:
ADAMJR 2021-12-23 16:14:48 +00:00
parent edd10457b5
commit 87356994d3
4 changed files with 28 additions and 4 deletions

View File

@ -1,11 +1,17 @@
# Accord - API # Accord - API
Tested code that brings Accord to life. Tested code that brings Accord to life.
![Lines of Code](https://img.shields.io/tokei/lines/github/d-clone/API?color=46828d&style=for-the-badge) ![Lines of Code](https://img.shields.io/tokei/lines/github/d-clone/API?color=46828d&style=for-the-badge)
> © All rights reserved. This repo is not (yet) open source, and is awaiting completion. > © All rights reserved. This repo is not (yet) open source, and is awaiting completion.
## `.env` ## Non-Docker Setup .env
If you are not using Docker, you can use the following template as a guide.
### `.env`
```.env ```.env
API_URL="http://localhost:3000/api" API_URL="http://localhost:3000/api"
EMAIL_ADDRESS="example@gmail.com" EMAIL_ADDRESS="example@gmail.com"
@ -16,4 +22,18 @@ ROOT_ENDPOINT="http://localhost:3000"
WEBSITE_URL="http://localhost:4200" WEBSITE_URL="http://localhost:4200"
``` ```
> For help on setting up gmail mailing, go here - https://nodemailer.com/usage/using-gmail. ## Docker Setup .env
If you are using Docker, some variables will be substituted by Docker.
```.env
API_URL="http://localhost:3000/api"
EMAIL_ADDRESS="example@gmail.com"
EMAIL_PASSWORD="google_account_password"
MONGO_URI="mongodb://database/accord"
PORT=3000
ROOT_ENDPOINT="http://localhost:3000"
WEBSITE_URL="http://localhost:4200"
```
> For help on setting up gmail, go here - https://nodemailer.com/usage/using-gmail.

4
backend/nodemon.json Normal file
View File

@ -0,0 +1,4 @@
{
"watch": ["app.ts", "src/"],
"ext": "ts, css"
}

View File

@ -4,7 +4,7 @@
"scripts": { "scripts": {
"start": "npm run start:dev", "start": "npm run start:dev",
"start:dev": "set NODE_ENV=DEV && ts-node-dev --transpile-only src/app.ts", "start:dev": "set NODE_ENV=DEV && ts-node-dev --transpile-only src/app.ts",
"start:debug": "nodemon --exec node --inspect=0.0.0.0:9229 --require ts-node/register src/app.ts --ext 'ts,yml' --watch", "start:debug": "nodemon --exec node --inspect=0.0.0.0:9229 --require ts-node/register src/app.ts",
"start:prod": "ts-node-transpile-only src/app.ts", "start:prod": "ts-node-transpile-only src/app.ts",
"test": "npm run test:unit && npm run test:int", "test": "npm run test:unit && npm run test:int",
"test:int": "ts-mocha --exit test/e2e/test.ts", "test:int": "ts-mocha --exit test/e2e/test.ts",

View File

@ -13,4 +13,4 @@ connect(process.env.MONGO_URI, {
serverSelectionTimeoutMS: 0, serverSelectionTimeoutMS: 0,
}) })
.catch(error => log.error(error.message ?? 'Unable to connect to db', { uri: process.env.MONGO_URI })) .catch(error => log.error(error.message ?? 'Unable to connect to db', { uri: process.env.MONGO_URI }))
.then(con => log.info(`Connected to database on PORT ${con['port']}.`, { uri: process.env.MONGO_URI })); .then(con => log.info(`Connected to database.`, { uri: process.env.MONGO_URI }));