This project is a simple REST API that allows you to manage users, devices, and locations. This project is built using NestJS. This project also uses OpenAPI/Swagger to document and test the API endpoints.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Node.js
- NestJS
- TypeScript
- TypeORM
- PostgreSQL
- Clone the repository
git clone https://github.com/francisko-rezende/connect-lab-backend.git
-
Create a PostgreSQL database.
-
Create a
.env
file in the root of the project. Use the.env.example
file as a guide to setup the environment variables. -
Install the dependencies
npm install
- Run the migrations
$ npm run migration:run
- Run the application
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
The first time you set up the project, you will need to populate the database with the default devices and locations. To do this, you can use the /populate
endpoint.
POST /populate
This will add the default devices and locations to the database.
You can access the OpenAPI/Swagger page by visiting http://localhost:3000/api
in your browser with the app running. This page allows you to view the API documentation and test the endpoints.
You can download the OpenAPI JSON by visiting http://localhost:3000/api-json
in your browser with the app running. This will download the JSON file which contains the API documentation.
/sign-in
: Allows user to sign in with their credentials/user
: Allows user to create and retrieve their profile/change-password
: Allows the user to change their password/user-device
: Allows the user to link a device to their profile/user-devices
: Allows the user to retrieve all the linked devices/user-devices/{userDeviceId}
: Allows the user to retrieve a specific device linked to his profile
This project is licensed under the MIT License - see the LICENSE file for details