- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
Latest commit
32 lines (26 loc) · 1.05 KB
/
Copy pathserver.js
File metadata and controls
32 lines (26 loc) · 1.05 KB
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
importexpressfrom'express';
importbodyParserfrom'body-parser';
importpathfrom'path';
importmorganfrom'morgan';
importcorsfrom'cors';
importPlanCronfrom'./server/helpers/planCroneJob';
importuserRoutefrom'./server/router/user';
importplanRoutefrom'./server/router/plan';
importwalletRoutefrom'./server/router/wallet';
require('dotenv').config();
constapp=express();
app.use(cors());
app.options('*',cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json({type: 'application/json'}));
app.use(morgan(':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] :response-time ms'));
PlanCron();
app.use('/api/v1',userRoute);
app.use('/api/v1',planRoute);
app.use('/api/v1',walletRoute);
app.use(express.static(path.join(__dirname,'/dist/BitBuild')));
app.use('*',(req,res)=>res.sendFile(path.join(__dirname,'./dist/BitBuild/index.html')));
app.listen(process.env.PORT||'5000',()=>{
console.log('server is running');
});