git ssb

0+

cel-desktop / ssb-pkg



Tree: 938b7ea4cfaa3cef6e1690b9ef3ea8bd7a0d2de1

Files: 938b7ea4cfaa3cef6e1690b9ef3ea8bd7a0d2de1 / test / test-79-npm / express-with-jade / express.js

822 bytesRaw
1'use strict';
2
3var http = require('http');
4var express = require('express');
5var app = express();
6app.set('views', 'views');
7app.set('view engine', 'jade');
8
9app.get('/', function (req, res) {
10 res.render('fixture.jade', { title: 'Hey', message: 'Hello there!' });
11});
12
13var server = app.listen(1337, function () {
14 var port = server.address().port;
15 setTimeout(function () {
16 http.get('http://127.0.0.1:' + port.toString() + '/', function (res) {
17 var chunks = '';
18 res.on('data', function (chunk) {
19 chunks += chunk.toString();
20 }).on('end', function () {
21 if (chunks === '<html><head><title>Hey</title></head>' +
22 '<body><h1>Hello there!</h1></body></html>') {
23 console.log('ok');
24 }
25 server.close();
26 });
27 });
28 }, 100);
29});
30

Built with git-ssb-web