forked from IvonneQ21/g42beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
45 lines (33 loc) · 982 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
'use strict';
var SwaggerExpress = require('swagger-express-mw');
const express = require('express');
var app = require('express');
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