Welcome to the backend of the hAPPy project. This is a project done for the class 'Web-Engineering II' at the DHBW Stuttgart. This project is licensed with the MIT license.
- Some commands may only work in a linux environment. Development using windows is possible, though not recommended.
- Running postgresql database (for configuration see ormconfig.json)
- Node package manager Yarn
git clone [email protected]:WebII_hAPPy/hAPPy-backend.git
git cd happy-backend
Generate Secret Key and set environment variables with source
.
node -e "console.log(require('crypto').randomBytes(256).toString('base64'));"
Copy secret into app-env file
#file: app-env
export JWT_SECRET="{secret}"
export GMAIL_USER=""
export GMAIL_PASS=""
. ./app-env
Finally install packages with yarn
yarn install
yarn test
yarn start
Entities are the core of this application. Each entity describes a database table, its columns and their properties.
The database automatically synchronizes with the entities.
Each entity requires an id in form of a automatically generated integer.
Please refer to the TypeORM documentation for more information.
WARNING: Disable synchronization after first startup as unexpected errors may occur!
Controller are the interface between the internet and the this application. The controller methods will be called if you access an API endpoint.
Services are the interface between the database and this application. They get, save, update and delete data in database.
Each API endpoint is described under src/routes.ts and the under the OpenAPI specification (openapi.yaml). The corresponding Express.js function will automatically be build by a wrapper in src/index.ts
Tests are written with Mocha and Supertest.
Each individual route shall have a test.