var express = require('express');var bodyParser = require('body-parser');var app = express();app.use(bodyParser.text());app.post('/api/data', (request, response) => {console.log(JSON.stringify(request.body))});app.listen(3000, () => console.info('Application running on port 3000'));node stuff ^var url = 'http://localhost:3000/api/data/'fetch(url, {method: 'POST',body:JSON.stringify([username,password]),}).then(res => res.json()).catch(error => console.error('Error:', error)).then(response => console.log('Success:', response))javascript stuff ^
Submitted August 03, 2018 at 01:26AM by smiles_low
No comments:
Post a Comment