forked from heroku/node-js-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.js
More file actions
26 lines (21 loc) · 618 Bytes
/
Copy pathweb.js
File metadata and controls
26 lines (21 loc) · 618 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// run with node:
// node web.js
var express = require('express');
var fs = require('fs');
// Warning: express.createServer() is deprecated, express
// applications no longer inherit from http.Server,
// please use:
//
// var express = require("express");
// var app = express();
//
//var app = express.createServer(express.logger());
var app = express(express.logger());
app.get('/', function(request, response) {
var buffer = fs.readFileSync('index.html');
response.send(buffer.toString());
});
var port = process.env.PORT || 8080;
app.listen(port, function() {
console.log("Listening on " + port);
});