d0c3a2981c
* commit '3f6a7a4e5bd27fc4be70a1a63215ea97acaeb548': small fixes |
||
---|---|---|
.idea | ||
api | ||
data_import | ||
src | ||
static | ||
.gitignore | ||
.nvmrc | ||
build.bat | ||
manifest.yml | ||
package-lock.json | ||
package.json | ||
README.md | ||
tsconfig.json | ||
tslint.json |
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 executed 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.