-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
52 lines (41 loc) · 1.25 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
/**
|--------------------------------------------------
| import moduals from packedges
|--------------------------------------------------
*/
let express = require('express');
let bodyParser=require("body-parser");
let path =require('path');
let dotenv = require('dotenv');
let app = express();
let jobs = require('./routes/jobs');
let user = require('./routes/auth');
let cors = require('cors');
/**
|--------------------------------------------------
| use moduals
|--------------------------------------------------
*/
dotenv.config();
/**
|--------------------------------------------------
| only when ready to deploy
|--------------------------------------------------
*/
app.use(express.static(path.resolve(__dirname,"./public")) )
/**
|--------------------------------------------------
| use auth moduals
|--------------------------------------------------
*/
app.use(bodyParser.json());
app.use(express.json());
app.use(cors({credentials:true}));
app.use('/',user);
app.use('/jobs',jobs);
app.get('*', function (req, res) {
res.sendFile(path.resolve(__dirname,'./client/build','index.html'));
});
app.listen(process.env.PORT,()=>{
console.log(`port runnig on http://localhost:${process.env.PORT}`);
})