Skip to content Skip to sidebar Skip to footer

Simple Express.js Application Running With Error

i try to create simple express apllication serv.js: var express = require('express'), app = express(); app.listen(3000, function() { console.log('Server is run

Solution 1:

You have to define a route for the server to respond to requests.

var express = require('express'),
app = express();

app.get('/hello.txt', function(req, res){
  res.send('Hello World');
});

app.listen(3000, function() {
    console.log('Server is running');
});

Post a Comment for "Simple Express.js Application Running With Error"