- fork and clone this repo
- npm install
- run
node seed.js
from the command line to setup your database (you'll need to havemongod
running in the background) - to remove data from your database, run
mongo
from the command line, thenuse blog-api
. rundb.posts.remove()
to remove all posts, ordb.authors.remove()
to remove all authors. You can always runnode seed.js
again to re-seed the database - download Postman if you haven't already. It will be helpful for testing your api
Create an api with the following endpoints:
/api/posts
get all blog posts/api/posts/:id
get specific blog post (by id)/api/posts/sort/by-date
get all blog posts and order by dateapi/posts/sort/a-z
get all blog posts sorted alphabetically by title/api/authors
get all authors/api/authors/sort/a-z
get all authors sorted alphabetically/api/authors/:id
get specific author (by id)/api/posts/tags/react
get all blog posts that have a 'react' tag/api/posts-with-authors
get all posts with author fully populated (in other words, the full author information should be displayed, including author name and id)/api/posts
POST a new blog post/api/posts/:id
DELETE a blog post/api/posts/:id
PUT (update) a blog post
- refactor your routes to use express router
- Create a 'tag search' field. add an index.html file with a text input box. When you type something into the input box and hit 'Submit', your API should search all your posts for any posts that have a tag that matches the input text
- create a 'text search' field. add an index.html file with a text input box. When you type something into the input box and hit 'Submit', your API should search all your posts' bodies for any posts that contain the search word anywhere in their body. In other words, if you type in 'JavaScript' your should get a response will all posts that contain the word 'JavaScript' anywhere in the body