-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserve.js
30 lines (25 loc) · 848 Bytes
/
serve.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
30
'use strict';
var http = require('http')
, port = process.argv[2] || 3000
, ifcheck = require('../ifcheck')
, server = http.createServer(require('../server').create())
;
ifcheck.getExternalIp().then(function (ip) {
var host = ip || 'localhost'
, fqdn = ip || 'local.foobar3000.com'
;
server.listen(port, function() {
console.log('\n', 'Listening on http://' + host + ':' + port, '\n');
console.log('Test these links in your browser:');
console.log(' http://' + fqdn + ':' + port
+ '/resize/api?state=1'
+ '&url=http://i.imgur.com/qqpxDmJ.jpg'
);
console.log(' http://' + fqdn + ':' + port
+ '/resize/api?'
+ ['state=1', 'width=200', 'height=300', 'format=gif', 'quality=85'].join('&')
+ '&url=http://i.imgur.com/qqpxDmJ.jpg'
);
console.log('');
});
});