-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathapp.js
More file actions
26 lines (25 loc) · 748 Bytes
/
app.js
File metadata and controls
26 lines (25 loc) · 748 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
/*
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen('/tmp/node.sock', function() {
console.log('Server running on node.sock');
});
*/
var express = require('express');
var app = express();
app.get('/hello', function(req, res){
var body = 'Hello World';
res.setHeader('Content-Type', 'text/plain');
res.setHeader('Content-Length', Buffer.byteLength(body));
res.end(body);
});
app.get("/", function(req, res) {
var body = 'Hello World';
res.setHeader('Content-Type', 'text/plain');
res.setHeader('Content-Length', Buffer.byteLength(body));
res.end(body);
});
app.listen('/tmp/node.sock');
console.log('Listening on nginx socket');