-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
56 lines (42 loc) · 1.03 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
53
54
55
56
const express = require('express');
const session = require('express-session');
const flash = require('connect-flash');
const connect = require('./Data/connect');
require('dotenv').config({ path: './config/config.env' });
const app = express();
//!database connct
connect();
/**
*
* @param {String} name the username person
* @param {tel} tell the teel number person
* @param {Number} code the code secsess
* @returns {object} return object
*/
function creatperson(name, tell, code) {
return {
name,
tell,
code,
}
}
//* BodyPaser
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
//* View engine setup
app.set('view engine', 'ejs');
app.set('views', 'views');
app.use(session({
secret: process.env.SESSIONCODE,
saveUninitialized: true,
resave: true
}));
app.use(flash())
//!static folder
app.use(express.static('public'))
//!router
app.use("/", require('./routers/user'))
app.use(require("./controllers/errorc").get404);
app.listen(process.env.PORT, () => {
console.log("start");
})