Creating a basic-api-server to perform CRUD Operations on a database for code401 Lab 03
- Developed By: Erik Savage
Deployment URL: https://esavage-basic-api-server.herokuapp.com
- to install run
git@github.com:eriksavage/basic-api-server.git cdinto basic-api-server- run
npm install
- To start server run :
npm start - To test server run:
npm run test
'Cat', {
name: {
type: DataTypes.STRING,
allowNull: false,
},
breed: {
type: DataTypes.STRING,
allowNull: false,
},
age: {
type: DataTypes.INTEGER,
allowNull: false,
},
color: {
type: DataTypes.STRING,
allowNull: false,
},
}
'Food', {
name: {
type: DataTypes.STRING,
allowNull: false,
},
category: {
type: DataTypes.STRING,
},
healthy: {
type: DataTypes.BOOLEAN,
},
}
- POST
/cat, requires a cat object: returns created cat object from database - GET
/cat, returns an array of all cat objects entered in the database - GET
/cat/:id, requires database id returns a specific cat object entered in the database - POST
/cat/:id, requires database id and a cat object: updates a specific cat object entered in the database - DELETE
/food/:id, requires database id: deletes a specific food object from the database
- POST
/food, requires a food object: returns created food object from database - GET
/food, returns an array of all food objects entered in the database - GET
/food/:id, requires database id returns a specific food object entered in the database - POST
/food/:id, requires database id and a food object: updates a specific food object entered in the database - DELETE
/food/:id, requires database id: deletes a specific food object from the database
- Error Handling
- sends 404 if route or method is unavailable
Verifies the following:
- 404 on a bad route
- 404 on a bad method
The correct status codes and returned data for each REST route:
- Create a record using POST
- Read a list of records using GET
- Read a record using GET
- Update a record using PUT
- Destroy a record using DELETE
- sequelize docs
- jest docs
- supertest docs
- http cats
- Code Fellows
- Daniel Jackson
- Kellen Linse
