Back end part
Backend part of the project is contain under the services
directory. We decide to separate back-end and front-end with an Express API to be able to easly deploy multiple front-end view and separate data management from visualization.
The back-end part was developed using TypeScript.
Back end code structure
Under the back-end directory services
, you will be able to find the following code architecture:
devops/ (Scripts for setup and preparations)
dist/ (Compiled files)
node_modules/ (All dependecies are here after you run
npm i
)src/ (directory for TypeScript code)
api/ (all API files)
- controllers/ (Declare methods to handle each endpoints)
- helpers/ (Declare methods to factorize)
- routers/ (Declare route of API for each endpoints)
- validators/ (Declare schema for validate given data)
configs/ (files used for configuration and setup of the server)
declarations/ (Declaration of all interfaces used in projects)
models/ (Every models used to isolate database from code, coded for Sequelize )
utils/ (Every utility files)
app.ts (application file, prepare the application without running it)
server.ts (run server entry point)
.env (environment variables to config database and api - DotEnv)
jest.config.js (configuration file for Jest - CI)
montoring..log* (log files to debug API using Winston)
package.json (npm package and dependecie configuration)
tsconfig.json (TypeScript configuration file)
tslint.json (TypeScript linter configs)
Back end CMD
npm run build
: Compile back-end servernpm run serve
: Run servernpm run watch
: Run server and reload on file savenpm run test
: Run test for servernpm run lint
: Run linter on src filesnpm run debug
: Run server in debug mode and reload on file save