-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
43 lines (34 loc) · 1.13 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
require('dotenv').config()
const express = require("express");
const { auth } = require('express-openid-connect');
const app = express();
const router = require("./routes")
const db = require("./connection/db")
const path = require('path');
const cors = require('cors')
// const config = require("./config/nodemon.dev.json")
const Sequelize = require("sequelize");
const axios = require('axios');
const {cronjonForToken}= require("./common/cronjob")
// const config = {
// authRequired: false,
// auth0Logout: true,
// secret: process.env.SECRET,
// baseURL: process.env.BASEURL,
// clientID: process.env.CLIENTID,
// issuerBaseURL: process.env.ISSUER
// };
// app.use(auth(config));
app.use(cors())
app.use(express.json())
app.use('/assets', express.static(path.join(__dirname, 'assets')));
app.use("/", router)
db.sequelize.sync().then(() => {
app.listen(4000, () => {
console.log("server is working on port 4000")
})
console.log('Connection has been established successfully.');
}).catch((error) => {
console.error('Unable to connect to the database: ', error);
});
//cronjonForToken.start();