GithubHelp home page GithubHelp logo

reactnd-project-readable-starter's Introduction

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, use Create React App to scaffold out the front-end
    • create-react-app frontend
    • cd frontend
    • npm start

API Server

Information about the API server and how to use it can be found in its README file.

Archival Note

This repository is deprecated; therefore, we are going to archive it. However, learners will be able to fork it to their personal Github account but cannot submit PRs to this repository. If you have any issues or suggestions to make, feel free to:

reactnd-project-readable-starter's People

Contributors

ayoalik avatar forbiddenvoid avatar jamesbibby avatar nomemoryerror avatar richardkalehoff avatar sudkul avatar thalescomp avatar veronikabenkeser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reactnd-project-readable-starter's Issues

Authorization should be passed not AuthorizationReactND

in server.js, it says

app.use((req, res, next) => {
  const token = req.get('Authorization')

  if (token) {
    req.token = token
    next()
  } else {
    res.status(403).send({
      error: 'Please provide an Authorization header to identify yourself (can be whatever you want)'
    })
  }
})

note: Authorization is required, not as per documentation AuthorizationReactND

The README should include headers

I was never given instructions to add these headers. Although they are probably obvious to some, I had no idea for a while.

		'Content-Type': 'application/json',
		Accept: 'application/json',

in addition to

		Authorization: 'whatever-you-want',

Bug in posts.js - Not filtering out deleted posts

The getAll function in posts.js has a bug that causes deleted posts to not be filtered out. On line 60 there is the following let filtered_keys = keys.filter(key => !posts.deleted) but that should be let filtered_keys = keys.filter(key => !posts[key].deleted)

POST to /posts should contains PARAMS "author" not "owner"

going over the API as I was working on the project, one of the PARAMS to POST /posts needs to be changed (or atleast it seems like it, please correct me if I am wrong)

POST /posts
USAGE:
Add a new post

PARAMS:
id - UUID should be fine, but any unique id will work
timestamp - timestamp in whatever format you like, you can use Date.now() if you like
title - String
body - String
owner - String <-- should be changed
author - String <-- is what it needs to be
category: Any of the categories listed in categories.js. Feel free to extend this list as you desire.

get API returns

        "id": "8xf0y6ziyjabvozdd253nd",
        "timestamp": 1467166872634,
        "title": "Udacity is the best place to learn React",
        "body": "Everyone says so after all.",
        "author": "thingtwo",
        "category": "react",
        "voteScore": 6,
        "deleted": false
    }

POSTing with owner will result in no author being returned for future calls. It did for me.

Number of comments in a post (feature request)

It seems a little bit awkward that posts do not contain the number of comments. In order to show the number of comments (not the actual comments) for a post, you need to fetch all comments for the post and count them. A user may never click on a post to see the comments, but we still need to fetch them.

params for upvoting/downvoting comment missing

POST /comments/:id
USAGE:
Used for voting on a comment.

also the comment creation API asks for "owner", should be "author"

screen shot 2017-08-10 at 6 48 40 pm

sending in POST to the said API with no options or even with options similar to the post endpoint doesn't result in score being incremented/decremented.

comment from said post:
screen shot 2017-08-10 at 6 49 58 pm

as always apologies in advance for any oversights on my part

Bug in server.js - SyntaxError: Unexpected end of JSON input

      .then(
          (post) => {
              comments.disableByParent(req.token, post)
          })
      .then(
          (data) => res.send(data),
          (error) => {
              console.error(error)
              res.status(500).send({
                  error: 'There was an error.'
              })
          }
      )

should be

        .then(
            (post) => {
                comments.disableByParent(req.token, post)
                res.send(post)
            },
            (error) => {
                console.error(error)
                res.status(500).send({
                    error: 'There was an error.'
                })
            })

other wise console.log(data) before (data) => res.send(data) will get undefined, and if you try .then(res => res.json()) after fetch() in your api.js, you will get SyntaxError: Unexpected end of JSON input.

variables not found.

Hello,

the following variables are not found in the API, could you please correct this.

`src\backend\comments.js
Line 41:5: 'filtered_keys' is not defined no-undef
Line 42:9: 'filtered_keys' is not defined no-undef
Line 80:5: 'comment' is not defined no-undef
Line 83:13: 'comment' is not defined no-undef
Line 83:33: 'comment' is not defined no-undef
Line 86:13: 'comment' is not defined no-undef
Line 86:33: 'comment' is not defined no-undef
Line 91:9: 'comment' is not defined no-undef
Line 98:9: 'keys' is not defined no-undef
Line 99:9: 'filtered_keys' is not defined no-undef
Line 99:25: 'keys' is not defined no-undef
Line 100:9: 'filtered_keys' is not defined no-undef
Line 117:14: 'prop' is not defined no-undef
Line 118:26: 'prop' is not defined no-undef
Line 118:42: 'prop' is not defined no-undef

src\backend\posts.js
Line 90:5: 'post' is not defined no-undef
Line 93:13: 'post' is not defined no-undef
Line 93:30: 'post' is not defined no-undef
Line 96:13: 'post' is not defined no-undef
Line 96:30: 'post' is not defined no-undef
Line 101:9: 'post' is not defined no-undef
Line 116:14: 'prop' is not defined no-undef
Line 117:23: 'prop' is not defined no-undef
Line 117:36: 'prop' is not defined no-undef`

Votes to comments don't get updated

I tried to update vote to comment and then tried getting back all comments. I see vote gets updated on POST request. But after that, when I try to GET all comments for a post back, I do not find the vote updated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.