Home > Enterprise >  form-data in postman sending Empty body to nodejs
form-data in postman sending Empty body to nodejs

Time:09-30

I know this has been asked multiple times, but I have been looking around and still can't find an answer to my problem.

const express = require("express");
require("dotenv").config({
  path: ".env",
});
const PORT = process.env.PORT || 5000;
const runDatabase = require("./config/database");
const path = require('path')

const app = express()
const cors = require('cors')

app.use(cors())
app.use(express.json())


app.use("/uploads", express.static(path.join(__dirname, "uploads")));

// routers
const userRouter = require("./router/usersRouter");
const categoryRouter = require("./router/categoryRouter");
const productRouter = require("./router/productRouter");

app.use("/api", userRouter);
app.use("/api", categoryRouter);
app.use("/api", productRouter);

app.listen(PORT, () => {
  runDatabase();
  console.log(`           
  • Related