Life is endless, tossing and turning
Recently played Nodejs, began to use the Byvoid "Nodejs Development Guide" this book, but Nodejs change too fast, the following blog example to get to the database that one always do not, alas, people stupid should read more, so decided to abandon his process, and start again.
Version of WebStorm11.0 (trial 30 days) for editors. It is a web artifact that can be generated directly. Can be run directly, no need to go to cmd, supervisor./bin/www, it's so convenient for me to be such a lazy man. There are wood. Of course, you have to nodejs the environment first, no longer repeat.
Because before I heard that the jade template is better than the Ejs template, so holding a try to choose the mentality of jade template, although Ejs more close to HTML, easy to get started (this is something), but who call me love toss it.
Well, we're starting to learn jade again. So Baidu to: http://jade-lang.com/reference/iteration/, HTTP://SEGMENTFAULT.COM/A/1190000000357534#ARTICLEHEADER20
You can learn by referring to the two places above. Although the beginning of the translation of a few pieces of HTML, are right, but this is too troublesome, so lazy people began to think of ways: http://www.html2jade.org/directly to the HTML translated into Jade, according to learn the byviod of the Great God of the textbook, and online about 4.x knowledge, can refer to this http://blog.fens.me/nodejs-express4/, probably got a shell.
All right, this is it.
Say a question: just the template
This part, the beginning of writing with Jade, found that click Login or registration, and did not become gray, so you can layout.jade inside the corresponding place to insert, yes, 4.x is a Layout.jade file,
1 inch {'/': ' Home ', '/login ': ' Log in ', '/register ': ' Register '} 2 if Originalurl = = Index3 li.active4 A (href = index) = Val5 else6 li7 A (href = index) =val
Originalurl variable is the corresponding click on the first page, login, registration of the route address, you can in the corresponding JS file to pass this parameter, I began to want to pass in Req.originalurl, or Req.url or Req.baseurl did not succeed, and then directly use the address of the string constant instead of the
Nodejs express4.x Study Notes