-
Notifications
You must be signed in to change notification settings - Fork 0
2.2 Backend
The backend consist of routers, controllers and models. These files are located in subfolders under the same name within the folder api. index.js is the main component of the server, and it redirects HTTP-request to the appropiate route. The general data exchange pattern between the backend's different components is showcased in the diagram below.
To fire up the backend run the commands npm install and npm run within the backend directory from a command promt. The command nodemon can be used instead of npm run for test enviroments, as nodemon will cause the server to autoupdate after saving any changes made withing the direcotry.
The server will automatically deploy on port 3001. To change the port add a .env file in main backend directory. Simply add the content within the quotation marks:
- "PORT = <example_port>"
By default the backend's email capabilities won't work, as it is not hooked up to the organizations email by default for security reasons. It is possible to test the capabilities with any email. Simply add the following lines to .env file:
- "EMAIL = <example_adress>@<example_provider>.<example_code>"
- "PASSWORD = <example_password>"