You've done a great job building an employee-management API with placeholder data. Now you can be trusted to build the API with a real database!
In this first section, you'll be setting up the database with Prisma.
- Create a new PostgreSQL database named
prismatic-employees. - Initialize Prisma in this repo and connect it to that PostgreSQL database.
- Define the
Employeemodel in the schema with the following fields:id: int, primary key, auto incrementname: string
- Seed the database with 10 initial employees.
Now that your database is up and running, build an Express app that serves the following routes. Make sure to use the appropriate body-parsing and error-handling middleware!
GET /sends the message "Welcome to the Prismatic Employees API."GET /employeessends array of all employeesPOST /employeesadds a new employee with the provided name- Send 400 if name is not correctly provided
- Send the newly created employee with status 201
GET /employees/:idsends employee with specified ID- Send 404 if employee does not exist
PUT /employees/:idupdates employee with specified ID with provided data- Send 400 if name is not correctly provided
- Send 404 if employee does not exist
- Send the updated employee with status 200
DELETE /employees/:iddeletes employee with specified ID- Send 404 if employee does not exist
- Send just the status 204
Submit the link to your public GitHub repository.