Added link in index.js

This commit is contained in:
shobhitm23 2019-10-29 13:45:36 -04:00
parent 3f3a93be8c
commit 2fc37e3e34
2 changed files with 5 additions and 2 deletions

View File

@ -44,7 +44,7 @@ app.get("/user", fbAuth, getAuthenticatedUser);
/*------------------------------------------------------------------* /*------------------------------------------------------------------*
* handlers/post.js * * handlers/post.js *
*------------------------------------------------------------------*/ *------------------------------------------------------------------*/
const { getallPostsforUser, putPost const { getallPostsforUser, putPost, getAllPosts
} = require("./handlers/post"); } = require("./handlers/post");
app.get("/getallPostsforUser", getallPostsforUser); app.get("/getallPostsforUser", getallPostsforUser);
@ -52,6 +52,9 @@ app.get("/getallPostsforUser", getallPostsforUser);
// Adds one post to the database // Adds one post to the database
app.post("/putPost", fbAuth, putPost); app.post("/putPost", fbAuth, putPost);
// Displays posts on home page
app.post("/getAllPosts", getAllPosts );
/*------------------------------------------------------------------* /*------------------------------------------------------------------*
* handlers/topic.js * * handlers/topic.js *
*------------------------------------------------------------------*/ *------------------------------------------------------------------*/

View File

@ -71,7 +71,7 @@ class user extends Component {
}) })
}) })
.catch(err => console.log(err)); .catch(err => console.log(err));
axios.get('/posts') axios.get('/getAllPosts')
.then(res => { .then(res => {
this.setState({ this.setState({
posts: res.data posts: res.data