Answer the question
In order to leave comments, you need to log in
How to send and receive data in node.js server?
I am new to node.js , there is a code like this in vile api
var express = require('express');
var router = express.Router();
router.get('/', function(req, res, next) {
res.send('API is working properly');
});
module.exports = router;
const data = { username: 'example' };
function datasend(){
fetch(`http://localhost:9000/testAPI`)
.then(function (data) {
console.log('Request succeeded with JSON response', data);
})
.catch(function (error) {
console.log('Request failed', error);
});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question