-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (27 loc) · 1.04 KB
/
app.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
31
32
33
34
35
'use strict';
process.env.NODE_CONFIG_DIR = __dirname + '/config/';
const config = require('config');
const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');
const fs = require('fs');
const http = require('http');
const https = require('https');
const ejs = require('ejs');
const colors = require('colors');
const bot = require('./routes/bot');
const app = express();
app.set('port', config.get('PORT') || 8080);
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.use(bodyParser.json({limit: '10mb'}));
app.use(bodyParser.urlencoded({limit: '10mb', extended: true}));
app.use('/static', express.static(__dirname + '/public'));
app.get('/api/list', bot.list);
app.get('/api/convert/:number', bot.convert);
app.get('/api/screenshot/:number', bot.screenshot);
app.listen(app.get('port'), () => {
console.log('%s App is running on port %s mode', colors.green('✓'), app.get('port'), app.get('env'));
console.log(' Press CTRL-C to stop\n');
});
module.exports = app;