const express = require("express");
const bodyParser = require("body-parser");

const {
  createBlog,
  getBlogs,
  updateBlog,
  deleteBlog,
} = require("../controller/blog.controller");

const {
  createComments,
  getComments,
  updateComments,
  deleteComments,
} = require("../controller/comments.controller");

const {
  createTags,
  getTags,
  updateTags,
  deleteTags,
} = require("../controller/tags.controller");

const {
  createCategory,
  getCategory,
  updateCategory,
  deleteCategory,
} = require("../controller/category.controller");

const app = express();
app.use(bodyParser.json());
const PORT = 3000;

//-----------------------------Blogs-----------------------------


app.get("/api/blogs", getBlogs);

app.put("/api/blogs/:id", updateBlog);

app.delete("/api/blogs/:id", deleteBlog);

//-----------------------------Comments-----------------------------

app.post("/api/comment", createComments);

app.get("/api/comment", getComments);

app.put("/api/comment/:id", updateComments);

app.delete("/api/comment/:id", deleteComments);

//-----------------------------Categories-----------------------------

app.post("/api/category", createCategory);

app.get("/api/category", getCategory);

app.put("/api/category/:id", updateCategory);

app.delete("/api/category/:id", deleteCategory);

//-----------------------------Tags-----------------------------

app.post("/api/tags", createTags);

app.get("/api/tags", getTags);

app.put("/api/tags/:id", updateTags);

app.delete("/api/tags/:id", deleteTags);


app.listen(PORT, () => {
  console.log(
    `Your Server is Successfully running on http://localhost:${PORT} `
  );
});
