Lab9 Report - scvnq/demo1 GitHub Wiki

Lab9 Report

Students Information

Tiancheng Xie , ID:25

Chen Sun , ID:23

Goal:

•Create aLogin PageUsing PUG Template Engine.

•On Click of login button display details of user by retrieving from Cookie in NodeJS.

•Load CSS files using express.static() method.

1.Installing Pug

npm install pug --save

To set pug as template engine.

use Pug -Template Engine -Syntax to create page

This is the HTML page that we get Create a directory named“public”and store the CSS files in it.

CSS file can be accessed by this code:

Install cookie parser middleware by npm install --save cookie-parser

Add these into index.js

Result:

Login.page

jump to home.page

cookie

Conclusion:

The pug template engine is flexible and interesting for converting templates into HTML files. It is worth learning and studying.