-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (33 loc) · 1.17 KB
/
index.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
36
37
38
39
40
41
42
43
'use strict';
var express = require('express');
var kraken = require('kraken-js');
var path = require('path');
var options, app;
/*
* Create and configure application. Also exports application instance for use by tests.
* See https://github.com/krakenjs/kraken-js#options for additional configuration options.
*/
options = {
onconfig: function (config, next) {
/*
* Add any additional config setup or overrides here. `config` is an initialized
* `confit` (https://github.com/krakenjs/confit/) configuration object.
*/
next(null, config);
}
};
app = module.exports = express();
const cors = require('cors')
app.use(cors())
const bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false}));
app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users
global.log = require('./app/lib/logger');
global.appRoot = path.resolve(__dirname);
global.kraken = app.kraken;
app.use(kraken(options));
app.on('start', function () {
global.log.info('Application ready to serve requests.');
global.log.info('Environment: %s', app.kraken.get('env:env'));
});