Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frontendmasters/api-design-node-v3
[Course] API design in Node with Express v3
https://github.com/frontendmasters/api-design-node-v3
express mongodb mongoose nodejs rest
Last synced: 3 days ago
JSON representation
[Course] API design in Node with Express v3
- Host: GitHub
- URL: https://github.com/frontendmasters/api-design-node-v3
- Owner: FrontendMasters
- Created: 2018-12-03T15:02:28.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-01T20:58:04.000Z (11 months ago)
- Last Synced: 2025-01-11T14:05:28.711Z (10 days ago)
- Topics: express, mongodb, mongoose, nodejs, rest
- Language: JavaScript
- Homepage: https://frontendmasters.com/courses/api-design-nodejs-v3/
- Size: 288 KB
- Stars: 696
- Watchers: 23
- Forks: 964
- Open Issues: 38
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
> [!NOTE]
> This repo is from an archived version of the course. Watch the latest version of the course on [frontendmasters.com](https://frontendmasters.com/courses/api-design-nodejs-v4/).# Course Code for [API design in Node.js with Express, v3](https://frontendmasters.com/courses/api-design-nodejs-v3/)
> Scott Moss & Frontend Masters- [Resources](#resources)
- [Course](#course)
- [Exercises](#excercises)
- [Hello world Express](#hello-world-express)
- [Routing](#routing)
- [Create Schemas](#create-schemas)
- [Controllers](#controllers)
- [Authentication](#authentication)
- [Testing](#testing)## Resources
* [Slides](https://slides.com/scotups/api-design-in-node-with-express-v3/)
* [Nodejs](https://nodejs.org/en/)
* [Express](https://expressjs.com/)
* [MongoDB](https://www.mongodb.com/)## Course
This course has two parts, slides and excercises. The slides describe the excerices in detail. Each excercise has a starting branch and solution branch. Example `lesson-1` and `lesson-1-solution`.
## Exercises
### Hello world Express
* branch - `lesson-1`In this lesson you'll be creating a simple Express based API in node, just to get your feet wet.
- [ ] install dependencies with yarn (prefered for version locking) or npm
- [ ] create a route that sends back some json
- [ ] create a route that accepts json and logs it
- [ ] start the server### Routing
* branch - `lesson-2`
* test command - `yarn test-routes` or `npm run test-routes`This exercise will have you creating routes and sub routers for our soon the be DB resources using Express routing and routers
- [ ] create a router for the Item resource
- [ ] create full crud routes and create placeholder controllers
- [ ] mount router on the root server
- [ ] ensure all tests pass by running test command### Create Schemas
* branch - `lesson-3`
* test command - `yarn test-models` or `npm run test-models`In this exercise, you'll be taking what you learned about Mongoose and MongoDb to create a schema and model for the Item resource.
- [ ] create a schema for the item resource
- [ ] add the correct fields (look at test)
- [ ] add the correct validations (look at test)
- [ ] *extra* add compund index to ensure all tasks in a list have unique names
- [ ] ensure all tests pass by running test command### Controllers
* branch - `lesson-4`
* test command - `yarn test-controllers` or `npm run test-controllers`So far we have routes and models. Now we need to hook our routes up to our models so we can perfom CRUD on the models based on the routes + verbs. That's exactly what controllers do.
- [ ] create CRUD resolvers in `utils/crud.js`
- [ ] create controllers for the Item resources using the base crud resolvers
- [ ] ensure all tests pass by running test command### Authentication
* branch - `lesson-5`
* test command - `yarn test-auth` or `npm run test-auth`In this exercise you'll be locking down our API using JWT's.
- [ ] create a signup controller
- [ ] create a signin controller
- [ ] create a protect middlware to lock down API routes
- [ ] ensure all tests pass by running test command### Testing
THe other resources don't have any test, go ahead and write some!