Skip to content

Project for the final assessment project for Udacity's Redux course, a content and comment web app. Users will be able to post content to predefined categories and comment and vote on them.

Notifications You must be signed in to change notification settings

tayyab-razzaq/readable

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Readable API Server

This is the starter project for the final assessment project for Udacity's Redux course where you will build a content and comment web app. Users will be able to post content to predefined categories, comment on their posts and other users' posts, and vote on posts and comments. Users will also be able to edit and delete posts and comments.

This repository includes the code for the backend API Server that you'll use to develop and interact with the front-end portion of the project.

Start Developing

To get started developing right away:

  • Install and start the API server
    • cd api-server
    • npm install
    • node server
  • In another terminal window, install and start frontend server
    • cd frontend
    • npm install
    • npm start

Using The API Server

Include An Authorization Header

All requests should use an Authorization header to work with your own data:

fetch(
    url,
    {
        headers: { 'Authorization': 'whatever-you-want' }
    }
)

You can use the BooksAPI.js file from the MyReads Project as a guide for designing your own API calls for this project.

Comment Counts

Posts retrieved in a list or individually now contain comment counts in the format post: { commentCount: 0 }. This should make it easier to display the number of comments a post has without having to call the comments endpoint for each post. This count is updated whenever a comment is added or deleted via the POST /comments or DELETE /comments/:id endpoints.

API Endpoint

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. option - [String]: Either "upVote" or "downVote".
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.  

readable-frontend

Frontend React App for readable project of Udacity

This project was bootstrapped with Create React App.

About

Project for the final assessment project for Udacity's Redux course, a content and comment web app. Users will be able to post content to predefined categories and comment and vote on them.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.2%
  • CSS 1.6%
  • HTML 1.2%