node.js return json
server.get('/', (req, res) => {
const user = { name: 'Hero', isLearning: true, level: 'apprentice' };
return res.json(user);
})
node.js return json
server.get('/', (req, res) => {
const user = { name: 'Hero', isLearning: true, level: 'apprentice' };
return res.json(user);
})
node js return json
var http = require('http');
var app = http.createServer(function(req,res){
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify({ a: 1 }));
});
app.listen(3000);
// > {"a":1}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us