![]() My goal was to show you how to create a simple login page with express and pug. It’s finish, we do it static, with out database. Open public/stylesheets/style.css and change codes: html, body module.exports=login I want to create a login page like this sample : so have to change the view/layout.pug like below : doctype html html head title= title link(rel='stylesheet', href=' ') link(rel='stylesheet', href='./stylesheets/style.css') body block content script(src=' ') script(src=' ') script(src=' ') Now run the code below to start server on port 3000. we want to work with pug template engine, so we have to include ` - view=pug` in our command. This command will create an express project with some needed dependencies. Now initial our project : $ cd /var/www/html $ mkdir expressLogin $ cd expressLogin $ npm initĮxpress will ask you some questions, answer those and go to next step. įirst install express generator to configure our project as well : npm install express-generator -g In a template, a block is simply a block of Pug that a child template may replace. ![]() The main reason that i decide to write this article, is to show you how much is cute to write your UI with pug, this login page is so simple an Database less. Template inheritance works via the block and extends keywords. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |