A simple connect middleware for rapidly creating pages
npm install connect connect-simple
Use the connect middleware like so...
var connect = ;var simple = ;var app = ;
In your app's root directory, create the file ./www/index.js
var ua = thisreqheaders'user-agent';thisres;
Start your app, and go to
http://localhost:3000, you should see your browser's user agent
You can add js files to the /www folder and you will be able to access them in your browser, for example
http://localhost:3000/test will resolve to
this.req will refer to the node.js request object.
There will also be a variable called
this.res which will refer to the node.js response object.
In some cases, there may be things that you will need access to in all your pages (for example, underscore), you can do this by importing them:
var connect = ;var simple = ;var underscore = ;var app =;
In this example, you will be able to access underscore from within your pages: