Node.js fs read json file

Description

Node.js fs read json file

console.log("Starting...");
var fs = require("fs");
var config = JSON.parse(fs.readFileSync("config.json"));
var host = config.host;
var port = config.port;
var express = require("express");

var app = express();

app.get("/", function (request, response) {
  response.send("hello!");
});/*from w  w w  .j a v a 2  s  .com*/

app.listen(port, host);



PreviousNext

Related