-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
54 lines (38 loc) · 1.25 KB
/
Copy pathserver.js
File metadata and controls
54 lines (38 loc) · 1.25 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const express = require("express");
const path = require("path");
const cors = require('cors');
const corsOptions = require('./config/corsOptions')
const bodyParser = require("body-parser");
/*
|--------------------------------------------------------------------------
| Create an instance of the express module
|--------------------------------------------------------------------------
|
| Express is a minimal and flexible Node.js web application framework that
| provides a robust set of features for web and mobile applications.
|
*/
const app = express();
/*
|--------------------------------------------------------------------------
| Setup a default template engine
|--------------------------------------------------------------------------
*/
app.set('views', path.join(__dirname, './resources/views'));
app.set('view engine', 'hbs');
/*
|--------------------------------------------------------------------------
| Setup a body parser
|--------------------------------------------------------------------------
*/
app.use(bodyParser.json());
app.use(express.json());
app.use(cors(corsOptions));
app.use(
bodyParser.urlencoded({
extended: true,
})
)
const userApi = require("./routes/api/user");
app.use('/', userApi);
module.exports = app