this only logs {}How do i make it log test?var url = 'http://localhost:3000/api/data/'fetch(url, {method: 'POST',body: 'test',}).then(res => res.json()).catch(error => console.error('Error:', error)).then(response => console.log('Success:', response))Regular javascript ^const express = require('express');const bodyParser = require('body-parser');const app = express();app.use(bodyParser.urlencoded({ extended: false }));app.post('/api/data', (request, response) => {console.log(request.body);});app.listen(3000, () => console.info('Application running on port 3000'));Node app ^
Submitted August 02, 2018 at 08:11PM by smiles_low
No comments:
Post a Comment