Showing
3 changed files
with
8 additions
and
1 deletions
... | @@ -3,6 +3,12 @@ const bodyParser = require('body-parser'); | ... | @@ -3,6 +3,12 @@ const bodyParser = require('body-parser'); |
3 | const session = require('express-session'); | 3 | const session = require('express-session'); |
4 | const app = express(); | 4 | const app = express(); |
5 | 5 | ||
6 | +app.set('views', __dirname + '/views'); | ||
7 | +app.set('view engine', 'ejs'); | ||
8 | +app.engine('html', require('ejs').renderFile); | ||
9 | +app.use(express.static('public')); | ||
10 | + | ||
11 | + | ||
6 | app.use(bodyParser.json()); | 12 | app.use(bodyParser.json()); |
7 | 13 | ||
8 | app.use(session({ | 14 | app.use(session({ |
... | @@ -14,7 +20,7 @@ app.use(session({ | ... | @@ -14,7 +20,7 @@ app.use(session({ |
14 | 20 | ||
15 | //Home | 21 | //Home |
16 | app.get('/', function(req,res){ | 22 | app.get('/', function(req,res){ |
17 | - res.send("Home page"); | 23 | + res.render("index.html"); |
18 | }) | 24 | }) |
19 | 25 | ||
20 | //login | 26 | //login | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
10 | "license": "ISC", | 10 | "license": "ISC", |
11 | "dependencies": { | 11 | "dependencies": { |
12 | "body-parser": "^1.19.0", | 12 | "body-parser": "^1.19.0", |
13 | + "ejs": "^3.1.6", | ||
13 | "express": "^4.17.1", | 14 | "express": "^4.17.1", |
14 | "express-session": "^1.17.1", | 15 | "express-session": "^1.17.1", |
15 | "mysql": "^2.18.1", | 16 | "mysql": "^2.18.1", | ... | ... |
-
Please register or login to post a comment