-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
62 lines (31 loc) · 1.03 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const express = require('express');
const app = express();
const jwt = require('jsonwebtoken');
const bcrypt = require('bcrypt');
require('dotenv').config();
//configure body-parser for express
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({extended:false}));
app.use(bodyParser.json());
const cors = require('cors');
app.use(cors());
//import controller modules
const auth = require('./controllers/AuthController')
const patch = require('./controllers/JsonPatchController')
const thumbnail = require('./controllers/ThumbnailDownloadController')
app.use('/api/auth', auth)
app.use('/api/patch', patch)
app.use('/api/thumbnail', thumbnail)
app.get('/', (req, res)=>{
res.setHeader('Content-Type', 'text/html');
res.status(200).sendFile(__dirname + "/" + "docs/swagger.json");
});
//set the port through env
const port = process.env.PORT || 3000;
app.listen(port, (err)=>{
if(err){
console.log(err);
}
console.log('server started at port: ' + port);
});
module.exports = app