async function sendMe()
{
let r =await fetch('/test', {method: 'POST', body: JSON.stringify({a:"aaaaa"}), headers: {'Content-type': 'application/json; charset=UTF-8'}})
let res = await r.json();
console.log(res["a"]);
}
If you are looking for simplier NodeJS express is on the go choice for you.
expressJS is:
> NodeJS framework
> Free to use
USES = ['twitter', 'paypal', 'yandex', 'bbc', 'sohu', 'and so on.']
Express.js, or simply Express, is a web application framework for Node.js,
released as free and open-source software under the MIT License.
It is designed for building web applications and APIs.
It has been called the de facto standard server framework for Node.js.
const express = require("express")
const app = express();
// GET method route
app.get('/', function (req, res) {
res.send('GET request to the homepage');
});
// POST method route
app.post('/', function (req, res) {
res.send('POST request to the homepage');
});
app.listen(3000,()=>{
console.log("this App is running on port 3000")
})
var express = require('express');
var app = express();
var PORT = 3000;
app.get('/profile', function (req, res) {
console.log(req.query.name);
res.send();
});
app.listen(PORT, function(err){
if (err) console.log(err);
console.log("Server listening on PORT", PORT);
});
Express.js, or simply Express, is a back end web application framework for Node.js, released as free and open-source software under the MIT License.
It is designed for building web applications and APIs.
It has been called the de facto standard server framework for Node.js.