Sheppard Somers May 2019
Create a mimic of the class api that can store blogs and return them. It also has user sign in and creation. It has the paths:
- GET /api/posts/ returns only title and tags for all posts [[{"id":"",title":"","tags":""},...]
- POST /api/posts/ with post parameters {'title', 'tags', 'content'} creates a new post
- PUT /api/posts/:postID with parameters {'title', 'tags', 'content'} will update an entry
- GET /api/posts/:postID returns the post found at postID
- DELETE /api/posts/:postID deletes the post found at postID
- POST /api/signup signs up a user with email, username, password
- POST /api/signin sign in a user with email, username and password
mongod
to start the database itself. Can also runmongod &
to run in the background.mongo
if you want to interact from terminal with the database.yarn dev
to run the server on the local port.
What it is rn. At least as far as I can tell.
I forgot that mongoose returns promises so you have to use .then or pass in a function that then stores (sends) the results. I basically inverted it like it was a normal function, and put the find() inside of the res.send, rather than the other way around. I also had an issue where I was testing with CURL where I pasted the id incorrectly and didn't think to retype the curl request as it kept failing. This took a lot of time as silly bugs normally do. But was all fine when I realized this and sent a correct curl request.
- node with babel
- expressjs
- airbnb eslint rules
Procfile set up to run on heroku
The frontend has its own sources listed. This part as usual is based mainly off of the assignment and class materials. Katie Goldstein reminded me that the mongoose methods return a promise.