From 87356994d39a51636e77d0fcb1dba2779e50dc6b Mon Sep 17 00:00:00 2001 From: ADAMJR Date: Thu, 23 Dec 2021 16:14:48 +0000 Subject: [PATCH] Backend: Projects restarts on save --- backend/README.md | 24 ++++++++++++++++++++++-- backend/nodemon.json | 4 ++++ backend/package.json | 2 +- backend/src/app.ts | 2 +- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 backend/nodemon.json diff --git a/backend/README.md b/backend/README.md index c0b811bc..00c8f4f3 100644 --- a/backend/README.md +++ b/backend/README.md @@ -1,11 +1,17 @@ # Accord - API + 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) > © 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 API_URL="http://localhost:3000/api" EMAIL_ADDRESS="example@gmail.com" @@ -16,4 +22,18 @@ ROOT_ENDPOINT="http://localhost:3000" WEBSITE_URL="http://localhost:4200" ``` -> For help on setting up gmail mailing, go here - https://nodemailer.com/usage/using-gmail. \ No newline at end of file +## 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. diff --git a/backend/nodemon.json b/backend/nodemon.json new file mode 100644 index 00000000..4983de46 --- /dev/null +++ b/backend/nodemon.json @@ -0,0 +1,4 @@ +{ + "watch": ["app.ts", "src/"], + "ext": "ts, css" +} \ No newline at end of file diff --git a/backend/package.json b/backend/package.json index f8c8310e..bfb87e2c 100644 --- a/backend/package.json +++ b/backend/package.json @@ -4,7 +4,7 @@ "scripts": { "start": "npm run start:dev", "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", "test": "npm run test:unit && npm run test:int", "test:int": "ts-mocha --exit test/e2e/test.ts", diff --git a/backend/src/app.ts b/backend/src/app.ts index 7efe5a46..a6a82468 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -13,4 +13,4 @@ connect(process.env.MONGO_URI, { serverSelectionTimeoutMS: 0, }) .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 })); \ No newline at end of file +.then(con => log.info(`Connected to database.`, { uri: process.env.MONGO_URI })); \ No newline at end of file