NodeJs
丛林隐士
...
展开
-
ExpressJs - 03 - Jade to html
var jade = require ('jade'); /* -- convert jade to html */ // compileFile //var fn = jade.compile('string of jade', {}); var fn = jade.compileFile( './views/_header.jade', {}); // here is you原创 2015-04-02 06:24:12 · 345 阅读 · 0 评论 -
ExpressJs - 02 - how to access the attributies of req and res
function(req, res) { req.params // get info from url req.query // to get info as a query string req.body // to get access to the info submitted as part of the form };原创 2015-04-01 06:06:21 · 310 阅读 · 0 评论 -
ExpressJs - 01 - nodemon
$ npm install -g nodemon $ nodemon yourJsFile // e.g. nodemon server Note: It will restart the js project whenever there is a change. Good for nodeJs development.原创 2015-04-01 05:45:17 · 294 阅读 · 0 评论 -
ExpressJs - 04 - what does express.static(__dirname) point do?
In Node, the __dirname is a global object that contains the name of the directory that the executing script resides from. For example, if you are running node script.js from '/home/user/env', then __转载 2015-04-07 06:46:17 · 464 阅读 · 0 评论