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)
})
app.post('/users', (req, res) => {
const user = req.body;
user.id = users.length + 1;
users.push(user);
res.send(user)
});
fetch('',{
method:'POST',
headers:{
'content-type': 'application/json'
},
body:JSON.stringify(users)
})
.then(res=> res.json())
.then(data => console.log(data))
app.post('/quotes', (req, res) => {
console.log(req.body)
})
app.post('/', function (req, res) {
res.send('Got a POST request')
})
app.post('/users', (req, res) => {
const user = req.body;
user.id = users.length + 1;
users.push(user);
res.send(user)
});