Backend API server for Guestme App
Details about how to configure the development environment.
Please ensure the following extensions are installed:
- Prettier - Code formatter
- ESLint
- Better Comments
- Rest Client (new)
- Code Spell Checker (optional)
Please open the settings.json file in your VSCode. You can do so by:
- Press
Ctrl+Shift+p
- Enter
settings.json
- Select:
Preferences: Open Settings (JSON)
Then copy and paste the following into the file and save:
// <-- EDITOR --> //
"editor.tabSize": 2,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"editor.formatOnSave": true,
"editor.bracketPairColorization.enabled": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.addMissingImports": true,
"source.organizeImports": true,
"source.autoFixOnSave": true
},
"editor.suggestSelection": "first",
"diffEditor.ignoreTrimWhitespace": false,
"files.trimTrailingWhitespace": true,
// <-- ESLINT --> //
"eslint.quiet": false,
"eslint.format.enable": true,
// <-- LANGUAGE-SPECIFIC SETTINGS --> //
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": true,
"javascript.preferences.quoteStyle": "single",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[javascriptreact]": {
"editor.formatOnSave": true
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
Warning! you must install the extensions first otherwise VSCode may complain that some of the settings do not exist.
Key | Value |
---|---|
PORT | 8080 |
DB_DIALECT | MongoDB |
DB_HOST | MongoDB Atlas |
DATABASE_ACCESS | Contact Admin for database url |
DB_NAME | guest_me_app |
MODE | development |
DOMAIN | localhost (guestmeapp.heroku.com in production, if not specified defaults to localhost) |
JWT_SECRET_ACCESS | JWT Secret get from Heroku or generate using node crypto module |
AWS_ACCESS_KEY_ID | Get from admin |
AWS_SECRET_ACCESS_KEY | Get from admin |
S3_BUCKET | teamneptune |
The following is a summary of the scripts (more will be added later):
Script | Command | Description |
---|---|---|
test | npm run test | Not currently implemented. |
dev | npm run dev | Starts the development environment. |
build | npm run build | Builds the application. |
Ensure you first run npm install
. Then there are two methods to run the app:
Development
-
Ensure your machine is connected to the Internet for database access to MongoDB Atlas Cloud.
-
npm run start
will start the application in development mode. The application should hot reload after saving changes to a file -
Whenever a new endpoint is added, please also add it to the
endpoints
folder.
When launching the app you should see a message like this in the console:
🛫 Server ready at http://localhost:8080/