-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
48 lines (34 loc) · 1001 Bytes
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
'use strict';
var SwaggerExpress = require('swagger-express-mw');
const express = require('express');
var app = express()
const path = require('path');
const cors = require('cors');
const auth = require('./validations/verifytoken.js');
var config = {
appRoot: __dirname // required config
};
app.use(express.static(path.join('public')));
app.use(cors());
var config = {
appRoot: __dirname
};
// app.use('/groups', auth.verifyToken);
//
// app.use('/users', auth.verifyToken);
SwaggerExpress.create(config, function(err, swaggerExpress) {
if (err) { throw err; }
// install middleware
swaggerExpress.register(app);
var port = process.env.PORT || 10010;
// app.listen(port);
app.listen(port, () => {
if (app.get('env') !== 'test') {
console.log('Listening on port', port);
}
})
if (swaggerExpress.runner.swagger.paths['/hello']) {
console.log('try this:\ncurl http://127.0.0.1:' + port + '/hello?name=Scott');
}
});
module.exports = app; // for testing