Full Stack Java Script Project 11 - Treehouse TechDegree
Build REST API using Node, Express and mongoDB and Postman
Create a REST API using Express. The API will provide a way for users to review educational courses: users can see a list of courses in a database; add courses to the database; and add reviews for a specific course.
To complete this project, you’ll use your knowledge of REST API design, Node.js, and Express to create API routes, along with Mongoose and MongoDB for data modeling, validation, and persistence.
Confirmation of all routes will be performed using Postman.
The project entails the following steps:
- Set up a database connection.
- Create your Mongoose schema and models. Your database schema should match the following requirements:
- User
- Course
- Review
- Seed your database with data.
- Create the user routes
- Create the course routes
- Update any POST and PUT routes to return Mongoose validation errors.
- Update the User model to store the user's password as a hashed value.
- Create an authentication method on the user model to return the user document based on their credentials
- Set up permissions to require users to be signed in
To get an "exceeds" rating, you can expand on the project in the following ways:
- Review model - Validation added to prevent a user from reviewing their own course
- User routes
- Tests have been written for the following user stories:
- When I make a request to the GET /api/users route with the correct credentials, the corresponding user document is returned
- When I make a request to the GET /api/users route with the invalid credentials, a 401 status error is returned
- Tests have been written for the following user stories:
- Course routes
- When returning a single course for the GET /api/courses/:courseId route, use Mongoose deep population to return only the fullName of the related user on the course model and each review returned with the course model.