Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

express post

app.post('/signup', async(req, res) => {
  const { email, firstName } = req.body
  const user = new User({ email, firstName })
  const ret = await user.save()
  res.json(ret)
})
Comment

express receive post

app.post('/users', (req, res) => {
    const user = req.body;
    user.id = users.length + 1;
    users.push(user);
    res.send(user)
});
Comment

express post method

fetch('',{
	method:'POST',
  	headers:{
    	'content-type': 'application/json'
    },
  	body:JSON.stringify(users)
})
.then(res=> res.json())
.then(data => console.log(data))
Comment

express post method

app.post('/quotes', (req, res) => {
  console.log(req.body)
})
Comment

express post

app.post('/', function (req, res) {
  res.send('Got a POST request')
})
Comment

express post

app.post('/users', (req, res) => {
    const user = req.body;
    user.id = users.length + 1;
    users.push(user);
    res.send(user)
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: create react app with vite 
Javascript :: nodejs routes 
Javascript :: two array in one js 
Javascript :: angular list contains property 
Javascript :: Create MD5 hash with Node.js 
Javascript :: discord.js v13 if dm 
Javascript :: how to convert json to javascript object in ajax success 
Javascript :: closure in js 
Javascript :: tailwind content for nextjs 
Javascript :: set attribute javascript 
Javascript :: string normalize javascript 
Javascript :: how to remove more than one attribute using jquery 
Javascript :: js convert string array to number array 
Javascript :: react blur background 
Javascript :: vue mapgetters with parameter 
Javascript :: js class exists 
Javascript :: send mail, nodemailer, nodemailer, mailer, nodemailer npm 
Javascript :: linking html with javascript 
Javascript :: how to call function from parent component in child component vue 
Javascript :: json stringify double quotes 
Javascript :: getDataSnapshotFirebase 
Javascript :: react native paper modal background 
Javascript :: netmask /24 
Javascript :: hello world in html using javascript 
Javascript :: exporting a class 
Javascript :: remove duplicates multidimensional array javascript 
Javascript :: array iteration 
Javascript :: disable button js 
Javascript :: remove duplicate value from string 
Javascript :: how to get element by class name javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =