This week we're building our own Happy Thoughts API using express.js, mongoose and MongoDB.
This assignment, too, was pretty straight forward. Following the instructions and looking back on past to weeks made solving this rather painless.
Again, I opted for using "app.route().method()" to group the methods for the respective routes - I just think it looks cleaner.
Switching out the API on the frontend worked!
Added get and delete for single thought by _id.
- I might add some queries for filtering
- pagination
- Stretch goals suggest adding categories, tags and user names
- I wonder I how can prevent others from using my API and filling up my database... maybe it's next week Authentication?
- Your API should implement the routes exactly as documented in the instructions above (see instructions.md)
- Your
GET /thoughtsendpoint should only return 20 results, ordered bycreatedAtin descending order. - Your API should validate user input and return appropriate errors if the input is invalid.
- In the
POST /thoughtsendpoint to create a new thought, if the input was invalid and the API is returning errors, it should set the response status to400(bad request). - The endpoint to add hearts to a thought should return an appropriate error if the thought was not found.
Happy Thoughts API on Render Happy thoughts front end on Netlify