-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
47 lines (34 loc) · 1.2 KB
/
app.js
File metadata and controls
47 lines (34 loc) · 1.2 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var express = require('express');
var ImageMiddleware = require ('express-cache-gm-image');
var adaptCall = require('./middlewares/size-adapter.js');
var statistics = require('./middlewares/statistics.js');
const staticOptions = {
maxAge: 86400000
};
const name =
" ______ ___ _ __________ _ _ ______ _____ \n" +
" / __ \\ \\ / / \\ | |___ / __ \\| \\ | | ____|/ ____| \n" +
" | | | \\ \\ /\\ / /| \\| | / / | | | \\| | |__ | (___ \n" +
" | | | |\\ \\/ \\/ / | . ` | / /| | | | . ` | __| \\___ \\ \n" +
" | |__| | \\ /\\ / | |\\ |/ /_| |__| | |\\ | |____ ____) | \n" +
" \\____/ \\/ \\/ |_| \\_/_____\\____/|_| \\_|______|_____/ ";
const app = express();
app.use(adaptCall());
app.use(statistics());
app.get('/statistics', function(req, res){
});
app.get('/*', ImageMiddleware({
root: './public',
cacheDir: './cache/imager',
staticOptions: staticOptions,
nextFunction: function (req, res) {
return res.status(404).send('Not Found')
}
}))
var server = app.listen(3000, function () {
console.log(name);
console.log('\n Service is running port 3000!')
});
exports.closeServer = function(){
server.close();
};