Work through node-express-mini
- CRUD
- Create
- Read
- Update
- Delete
- REST
- GET
- PUT
- POST
- DELETE
- Middleware - use built-in and third party Middleware
- Modularize routes using
express.Router()
- Configuring sub-routes
- Ordering routes
- Configuring CORS for SPA + API architecture
What is CRUD? What is REST? How are they similar / different? What problem are they trying to solve?
What is middleware? What is middleware used for?
- Third-party middleware
- Custom middleware
How do you use middleware?
What does modularize mean? How do we "modularize" code? What benefits does modularizing have?
Hair salon app
With schemas for Customers
, Appointments
, and Products
in your database, what are some different ways you could display that data in a React app?
Project calls for:
- List of customers
- List of appointments for a customer
- List of customers that have purchased a specific product
- List of customers with no scheduled appointment
Subroutes to the rescue!
GET '/api/customers'
;
GET '/api/customers/no-appointments'
GET 'api/products/:id/customers
||
GET 'api/products/:id?hasPurchased=true
REST constraints:
- Stateless - requests don't rely on each other
- uniform interfaces
Time to fail!!
What is it? What problem is it solving? How do we use it?