Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

How to access the request body when POSTing using Node.js and Express

const express = require('express');

const app = express();

app.use(express.json({extended: false})); //This is the line that you want to add

app.post('/postroute', (req, res) => {
    console.log('body :', req.body);
    res.sendStatus(200);
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: get a href value javascript 
Javascript :: javascript loop through array of objects 
Javascript :: how to copy text in js 
Javascript :: inarray jquery 
Javascript :: select element by data 
Javascript :: scroll to div jquery 
Javascript :: package json add git repo 
Javascript :: get last in array javascript 
Javascript :: node get current url 
Javascript :: how to cheack if a number is an integer or float in javascript 
Javascript :: update angular to specific version 
Javascript :: split string on multiple characters javascript 
Javascript :: extract numbers from a string javascript 
Javascript :: npm express-session 
Javascript :: javascript maximum date 
Javascript :: js minifier api 
Javascript :: elasticsearch field not exists 
Javascript :: min of an array javascript 
Javascript :: code for adding new elements in javascriipt js 
Javascript :: exit extension from chrome javascript 
Javascript :: React’ must be in scope when using JSX react/react-in-jsx-scope 
Javascript :: js fetch send json 
Javascript :: get date javascript format 
Javascript :: Convert a string to a number in jQuery 
Javascript :: axios download excel file 
Javascript :: electron file association 
Javascript :: js 2d array to object 
Javascript :: difference between backtick and quotes 
Javascript :: how to use compare password in node js 
Javascript :: check if a checkbox is checked jquery 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =