I am using node-typescript for my app. I made basic post request by using post man. I console log the request body. I get the data but in postman keep showing sending request and image. I don't see anything wrong in my code. I don't know what is the problem in post request. Ps: This is my first time I am using node-typescript express server.
This is basically all my express code
import express, { Application, Response, Request } from 'express';
import cors from 'cors';
import morgan from 'morgan';
import helmet from 'helmet';
const app: Application = express();
const port = 8000;
app.use(cors());
app.use(morgan("common"));
app.use(helmet());
app.use(express.json());
app.post('/api', (req: Request, res: Response) => {
console.log(req.body.Item); // I get the data
})
app.listen(port, () => {
console.log(`App listening at http://localhost:${port}`)
})
This is my command script
"scripts": {
"build": "tsc -p .",
"start": "ts-node server.ts",
"server": "ts-node server.ts"
},