Node.js express create server

Description

Node.js express create server

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 ww  .j  a  va2  s .  co m*/

app.get("/hello/:text", function (request, response) {
  response.send("Hello!" + request.params.text);
});

app.listen(port, host);



PreviousNext

Related