-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
62 lines (44 loc) · 1.22 KB
/
app.js
File metadata and controls
62 lines (44 loc) · 1.22 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
55
56
57
58
59
60
61
62
const express = require('express');
const path = require ('path');
const cors = require('cors');
const bodyParser = require('body-parser');//change
const nav= [
{
link:"/books",
title:"Books"
},
{
link:"/authors",
title:"Authors"
},
{
link:"/addbook",
title:"Add Book"
},
{
link:"/addauthor",
title:"Add Author"
}
]
const loginRouter = require('./src/routes/loginroute');
const signupRouter = require('./src/routes/signuproute');
const homeRouter = require('./src/routes/homeroute');
const booksRouter = require('./src/routes/booksroute');
const authorsRouter = require('./src/routes/authorsroute');
const app = new express;
app.set('views','./src/views');
app.set('view engine','ejs');
app.use(bodyParser.urlencoded({extended:true}));
app.use(express.json());
app.use(express.static(path.join(__dirname , '/public')));
app.use('/login',loginRouter);
app.use('/signup',signupRouter);
app.use('/home',homeRouter);
app.use('/books',booksRouter);
app.use('/authors',authorsRouter);
app.get('/',function(req,res){
res.render('index',{});
});
app.listen(5000,()=>{
console.log("Server Ready on 5000");//change
});