removed frontend
This commit is contained in:
parent
64f3d93a34
commit
f8e93ef154
|
@ -1,11 +0,0 @@
|
|||
const express = require("express");
|
||||
const bodyParser = require("body-parser");
|
||||
const postRoutes = require("./routes/post");
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(bodyParser.json()); //Parses application/json data
|
||||
|
||||
app.use("/posts", postRoutes);
|
||||
|
||||
app.listen(8080);
|
|
@ -1,16 +0,0 @@
|
|||
exports.getAllPosts = (req, res, next) => {
|
||||
res.status(200).json({
|
||||
title: "My First Post",
|
||||
like: 10,
|
||||
});
|
||||
};
|
||||
|
||||
exports.addNewPost = (req, res, next) => {
|
||||
const title = req.body.title;
|
||||
const likes = req.body.likes;
|
||||
res.status(201).json({
|
||||
status: "success",
|
||||
message: "Post Added successfully",
|
||||
data: { id: new Date(), title: title, likes: likes },
|
||||
});
|
||||
};
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"name": "backend",
|
||||
"version": "1.0.0",
|
||||
"description": "Backend for LPU HRD Project",
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
"start": "nodemon app.js"
|
||||
},
|
||||
"keywords": [
|
||||
"mern"
|
||||
],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^2.0.5"
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
const express = require("express");
|
||||
const postController = require("../controllers/post");
|
||||
const router = express.Router();
|
||||
|
||||
// GET /posts/
|
||||
router.get("/", postController.getAllPosts);
|
||||
|
||||
// POST /posts/add
|
||||
router.post("/add", postController.addNewPost);
|
||||
|
||||
module.exports = router;
|
Loading…
Reference in New Issue