Skip to content

tftic-fswd/fswd-api

Repository files navigation

FSWD API

NestJS RESTful API server application for the FSWD project.

See the FSWD API Specification for the API specification and documentation.

Description

This application use the standard mode project and the default HTTP server. It expose a RESTfull API for users authentication/authorization, managing users, books, bookmarks and courses resources.

  • Authentication, for users to register, sign-in, logout and reset their password. Authorization for users to validate or edit resources. The authentication can be done traditionaly with an email or via GitHub.

  • Bookmarks and books Theses module allow the management of theses resources. Unregistered users can consult the resources. Registered users can submit a resource. Users with privileged roles can validate a resource submission.

  • Courses

The persistance is done with a MySQL server using TypeORM. See the main project for more in depth infrastructre and architecture details.

See the FSWD Relational Model for the database implementation model and the entity relationship model.

Installation

npm install

Running the app

This API is part of a Docker stack as a service. See the main project to run the full stack.

Development

The API need the Docker database service or a mssql-server instance running. See the main project.

Create an environment variable file called .env and add the following:

DATABASE_TYPE=mysql
DATABASE_HOST=172.23.0.2
DATABASE_PORT=3306
DATABASE_NAME=test
DATABASE_USERNAME=root
DATABASE_PASSWORD=example
JWT_SECRET=d7a481461577ba4c3c4c6946cca7204b
JWT_EXPIRE=90
BCRYPT_HASH=7f91317e30a02bc7b87205e95b842df2

Adjust the configuration accordingly to the main project environments variables or your mssql-server configuration.

Start the server application:

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

References

Releases

No releases published

Packages

 
 
 

Contributors