Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

node.js return json

server.get('/', (req, res) => {
  const user = { name: 'Hero', isLearning: true, level: 'apprentice' };
  return res.json(user);
})
Comment

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}
Comment

PREVIOUS NEXT
Code Example
Javascript :: vuejs react on route chagne 
Javascript :: jspdf attach image file 
Javascript :: how to get datetime javascript now 
Javascript :: nuxt input mask 
Javascript :: local storal javascript 
Javascript :: order array of objects by id javascript 
Javascript :: material ui textfield change input color 
Javascript :: how to delete a cookie in js 
Javascript :: how to check if website is down javascript 
Javascript :: reactjs javascript is mobile and desktop 
Javascript :: Getting Elements by Class Name 
Javascript :: js narrate text 
Javascript :: find duplicate values in array object javascript 
Javascript :: usestate remove from array 
Javascript :: axios timeout post example 
Javascript :: get date now javascript 
Javascript :: get random number node js 
Javascript :: simple reactjs login form 
Javascript :: angular 9 dockerfile 
Javascript :: js cound how many clicks 
Javascript :: getting form values in javascript 
Javascript :: getx arguments 
Javascript :: javascript syntax for check null or undefined or empty 
Javascript :: initialize function javascript 
Javascript :: js get json keys 
Javascript :: js check link if exists 
Javascript :: inject image javascript 
Javascript :: base 64 in js 
Javascript :: javascript findindex 
Javascript :: datetime knex 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =