Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: several typos inside README.md, omitted mistakes, renamed test file #78

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

- [Resources](#resources)
- [Course](#course)
- [Exercises](#excercises)
- [Exercises](#exercises)
- [Hello world Express](#hello-world-express)
- [Routing](#routing)
- [Create Schemas](#create-schemas)
Expand All @@ -18,13 +18,13 @@
* [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`.
This course has two parts, slides and exercises. The slides describe the exercises in detail. Each exercise 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
- [ ] install dependencies with yarn (preferred 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
Expand All @@ -33,22 +33,22 @@ In this lesson you'll be creating a simple Express based API in node, just to ge
* 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
This exercise will have you creating routers and sub routes for our soon to be DB resources using Express routing and routers
- [ ] create a router for the Item resource
- [ ] create full crud routes and create placeholder controllers
- [ ] 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.
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
- [ ] *extra* add compound index to ensure all tasks in a list have unique names
- [ ] ensure all tests pass by running test command

### Controllers
Expand All @@ -58,19 +58,19 @@ In this exercise, you'll be taking what you learned about Mongoose and MongoDb t
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
- [ ] 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.
In this exercise you'll be locking down our API using JWT(JSON Web Token).

- [ ] create a signup controller
- [ ] create a signin controller
- [ ] create a protect middlware to lock down API routes
- [ ] create a protect middleware 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!
The other resources don't have any test, go ahead and write some!
2 changes: 1 addition & 1 deletion src/utils/__tests__/crud.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('crud controllers', () => {

const res = {
status(status) {
expect(status).toBe(400)
expect(status).toBe(404)
return this
},
end() {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const signin = async (req, res) => {
return res.status(400).send({ message: 'need email and password' })
}

const invalid = { message: 'Invalid email and passoword combination' }
const invalid = { message: 'Invalid email and password combination' }

try {
const user = await User.findOne({ email: req.body.email })
Expand Down