-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·53 lines (31 loc) · 1.09 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
44
45
46
47
48
49
50
51
52
// index.js
/* EXPRESS */
const express = require('express');
var cookieParser = require('cookie-parser')
const path = require('path');
require("dotenv").config({ path: `${__dirname}/.env` });
const app = express()
app.use(cookieParser())
var cors = require('cors')
app.use(cors())
//body parser middleware
const { urlencoded } = require('express');
app.use(express.json());
app.use(urlencoded({ extended: false }));
app.set('view engine', 'ejs');
var access_token = "";
var requestToken = "";
app.get("/test", (req, res) => {
res.status(200).send("server is up!");
})
app.use("/public", express.static("./public"));
//routes
app.use('/', require('./src/api/template'));
app.use("/auth", require('./src/api/auth/auth'));
app.use("/activity/onpost", require('./src/api/usr_activity'))
app.use("/activity/savepost", require('./src/api/usr_savings'))
app.use("/*", (req, res) => {
res.status(404).send(`<br><br><h1 style="text-align: center;">404 || content not found</h1>`);
});
const port = process.env.PORT || 5510;
app.listen(port, () => console.log('App listening on port ' + port ));