- [on console] npm i (to install the dependencies)
- create a .env file in the project root with this information: DATABASE_URL="file:./dev.db"
- [on console] npx prisma migrate dev, afterwards, on the console, Prisma will ask for a name for the migration, you can choose one.
- npm run dev (to run the application)
- now, you can do the next steps bellow!
- POST http://localhost:8080/users/create Send a JSON in the body of the request containing name, email, password and address. As shown below:
{
"name": "Igor",
"email": "[email protected]",
"password": "yourpass",
"address": "your address"
}
- GET http://localhost:8080/users/findUsers This request will return all users.
3.GET http://localhost:8080/users/getUser/{id} This request will return the user who has an ID equal to the one passed as a parameter in the URL.
-
PATCH http://localhost:8080/users/updateUser/{id} This request will change the data passed in the body (JSON) of the request, not necessarily all data. Example below:
{ "name": "Jhon", "email": "[email protected]" }
This action will change the name and email of the user.
-
DELETE http://localhost:8080/users/deleteUser/{id} This request will delete the user with the ID passed by the database parameter.