This project features an API built with NestJS. The API contains the following endpoints:
- GET "/": Hello World.
- POST "/auth/login": Login;
- GET "/auth/profile": get profile logged in;
- GET "/users/": get registered users;
- POST "/users/create": create a new user;
The login endpoint returns a authentication token, if the credentials are valid. Except for the login and hello world endpoints, all the other endpoints require a valid token on the request's auth header.
The API was deployed on Vercel. It can be accessed through the URL: https://dashboard-nestjs.vercel.app/.
The params for requesting each endpoint can be seen in the following section.
- Login endpoint
https://www.youtube.com/embed/6olkPquo02Q?si=dwRouc8aI8Oo3Yn7
- Profile endpoint
https://www.youtube.com/embed/JvTBJWoTHPc?si=AH2F6HBniHmgwZIg
- Users endpoint
https://www.youtube.com/embed/nNEVau69jG4?si=PG88a2du3Kq-M2yH
- Create User endpoint
https://www.youtube.com/embed/dFzqRjw_U-Q?si=8QoMW0_QOaUiiCKz
This is my first time deploying an API and it was actually pretty fast to do so, thanks to the great tutorial I found on how to deploy on Vercel.
The problems emerged when connecting the deployment build to the postgreSQL database on the cloud. Initially, my database connection was managed by TypeORM, but all the modules related with it had to be removed of my imports since Vercel's database didnt support its use. There were other ORM packages supported, but at that moment I chose to use pure SQL to query the database.