text: const express = require('express');
  const bodyParser = require('body-parser');
  
  
  const app = express();
  
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({
    extended: false
  }));
  
  app.use((req, res, next) => {
    res.setHeader("Access-Control-Allow-Origin",'*');
    res.setHeader(
      "Access-Control-Allow-Header",
      "Origin, X-Requested-With, Content-Type, Accept"
    );
  
    res.setHeader(
      "Access-Control-Allow-Methods",
      "GET", "POST, PATCH, DELETE, PUT, OPTIONS"
    );
  
    next();
  });
  
  app.post("/api/posts", (req, res, next) => {
    const post = req.body;
    console.log(post);
    res.status(201).json({
      message: `Post added successfully`
    });
  });
  
  
  
  
  module.exports = app;
  