forked from gongo/pizza-figlet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.js
29 lines (25 loc) · 781 Bytes
/
web.js
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
27
28
29
var express = require('express');
var app = express();
var figlet = require('figlet');
var port = process.env.PORT || 8080;
app.use('/', express.static(__dirname + '/public'));
app.get('/figlet', function(req, res) {
figlet(req.query.text, 'Old Banner', function(err, data) {
if (err) {
console.dir(err);
res.send(500, { error: err.code });
} else {
res.send(data);
}
});
});
var server = app.listen(port, function() {
console.log(__dirname + '/public');
console.log('Listening on port %d', server.address().port);
});
if (process.env.NODETIME_ACCOUNT_KEY) {
require('nodetime').profile({
accountKey: process.env.NODETIME_ACCOUNT_KEY,
appName: 'pizza-figlet' // optional
});
}