The purpose of this test is to create a NestJS API to obtain information on barcodes via the OpenFoodFact API.
-
Allow user registration via login/password
-
Allow authentication of a user via login / password
-
On an authenticated route, allow the search for a product by its barcode on the OpenFoodFacts API
-
Allow user update
-
Caching system calls to OpenFoodFacts
-
Dockerization
-
Kubernetes manifest for deployment
- Prisma as my ORM
- PostgresSQL
- Docker
- Redis
- Insomnia
- Kubernetes
- NPM
Make sure you have install in your cumputer :
After clonning my project, in the root directory run :
npm install
NB: put useful information in the .env file
- Run the app :
$ npm run project:start
docker exec -it nest-api-crud sh
-Open Docker Desktop. -Click on the container you want to access in the list of running containers. -Click on the "Terminal" button in the container details page.
npx prisma migrate dev
This command will sync the database with the API
To test the API you can use Postman or Insomnia
NB: all you have to do is connect to your database by entering your identifiers to check the data present in your database.
- Access this url : http://localhost:3001/auth/signup
user register field | type | required |
---|---|---|
string | yes | |
password | string | yes |
firstname | string | no |
lastname | string | no |
- Access this url : http://localhost:3001/auth/signin
user Authentication field | type | required |
---|---|---|
string | yes | |
password | string | yes |
NB: this generate an access token
NB: In the Headers put - Bearer {accesstoken}
- Access this url : http://localhost:3001/product/{barcode} (e.g: "http://localhost:3001/product/04963406")
- Access this url : http://localhost:3001/auth/update
Set in the form the data to update
user update field | type | required |
---|---|---|
string | yes | |
password | string | no |
firstname | string | no |
lastname | string | no |
In the root directory run :
kubectl apply -f kubernestes.deployment.yml
You can see the deployment by running:
kubectl get deployments
Checking which pod(s) are running
kubectl get pods
- Author - Christ Abessolo
- Portfolio - https://rova.vercel.app/