Archived
2
ReST API for DeFinMa (NodeJS)
This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
2020-09-02 13:18:33 +02:00
.idea added user status and prediction user 2020-08-26 19:37:36 +02:00
api small material changes for easier UI implementation 2020-08-31 13:47:12 +02:00
data_import added user status and prediction user 2020-08-26 19:37:36 +02:00
src Implemented new template change behaviour 2020-09-02 13:18:33 +02:00
static small fixes 2020-08-12 10:56:12 +02:00
.gitignore added test helper and rewrote tests 2020-04-27 11:44:28 +02:00
.nvmrc changed Node version 2020-07-30 12:47:21 +02:00
build.bat /authorized returns level, added device to spectrum measurement 2020-07-23 14:55:41 +02:00
manifest.yml added workaround for 'added' field compatible to MongoDB 3.6 2020-07-10 09:42:05 +02:00
package-lock.json changelog delete 2020-08-31 16:20:22 +02:00
package.json changelog delete 2020-08-31 16:20:22 +02:00
README.md adapted changelog 2020-08-28 16:50:33 +02:00
tsconfig.json implemented first /sample methods 2020-05-06 14:39:04 +02:00
tslint.json init 2020-01-14 13:25:13 +01:00

DeFinMa - API

This is the API to access the database of the digital fingerprint of plastics project. A deep insight into the project structure can be gained in the Bachelor Thesis.

API documentation

The API is documented using the Open API Specification 3.0.2 in the api and hosted together with the API under the /api-doc path. The online version can be found here. The files are automatically bundled and validated when starting the server.

Testing

Testing is done with mocha and can be executed using npm test.

General structure

index.ts is exectued when starting the server. It includes all setup tasks, registers middleware, routes and error handlers. Setting the NODE_ENV environment variable allows starting the server either in production, development or test mode.

All route files including the corresponding test files are in the routes folder. The validate folder stores Joi validations for data input and output.

models keeps all Mongoose database collection models.

helpers includes functions needed in multiple places like the authorization done for every route, csv conversion and object flattening as well as a mail service, registering an email address using the mail service on the BIC and replacing it with a logging statement in development.

test holds files for testing like the test database db.json loaded freshly for every test case and a helper utilized for easier testing. loadDev loads the db.json into the development database for a fresh start.