This is a project concerning the udacity react-redux course. In this project was built an app for posts and comments. Users can create posts, rate posts, create comments, and rate comments.
The code for the backend API Server may be download here : https://github.com/udacity/reactnd-project-readable-starter
To get started developing right away:
- Install and start the API server
cd api-server
npm install
node server
- In another terminal window, use Create React App to scaffold out the front-end
npm install
npm start
Information about the API server and how to use it can be found in its [README file]
The following endpoints are available:
Endpoints | Usage | Params |
---|---|---|
GET /categories |
Get all of the categories available for the app. List is found in categories.js . Feel free to extend this list as you desire. |
|
GET /:category/posts |
Get all of the posts for a particular category. | |
GET /posts |
Get all of the posts. Useful for the main page when no category is selected. | |
POST /posts |
Add a new post. | id - UUID should be fine, but any unique id will work timestamp - [Timestamp] Can in whatever format you like, you can use Date.now() if you like. title - [String] body - [String] author - [String] category - Any of the categories listed in categories.js . Feel free to extend this list as you desire. |
GET /posts/:id |
Get the details of a single post. | |
POST /posts/:id |
Used for voting on a post. | option - [String]: Either "upVote" or "downVote" . |
PUT /posts/:id |
Edit the details of an existing post. | title - [String] body - [String] |
DELETE /posts/:id |
Sets the deleted flag for a post to 'true'. Sets the parentDeleted flag for all child comments to 'true'. |
|
GET /posts/:id/comments |
Get all the comments for a single post. | |
POST /comments |
Add a comment to a post. | id - Any unique ID. As with posts, UUID is probably the best here. timestamp - [Timestamp] Get this however you want. body - [String] author - [String] parentId - Should match a post id in the database. |
GET /comments/:id |
Get the details for a single comment. | |
POST /comments/:id |
Used for voting on a comment. | |
PUT /comments/:id |
Edit the details of an existing comment. | timestamp - timestamp. Get this however you want. body - [String] |
DELETE /comments/:id |
Sets a comment's deleted flag to true . |