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
31
32
33
|
#!/usr/bin/env node
'use strict';
var express = require('express'),
morgan = require('morgan'),
compression = require('compression'),
bodyParser = require('body-parser'),
lastMile = require('connect-lastmile'),
multipart = require('./src/multipart'),
files = require('./src/files.js');
var app = express();
var router = new express.Router();
var multipart = multipart({ maxFieldsSize: 2 * 1024, limit: '512mb', timeout: 3 * 60 * 1000 });
router.get('/api/files/*', files.get);
router.put('/api/files/*', multipart, files.put);
router.delete('/api/files/*', files.del);
app.use(morgan('dev'));
app.use(compression());
app.use(bodyParser.json());
app.use(router);
app.use(lastMile());
var server = app.listen(3000, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Surfer listening at http://%s:%s', host, port);
});
|