quick-server
v0.5.1
Published
Is a small web server stub for NodeJS/Express/Hogan and can be run directly or require'd into a script. Uses Express, Hogan-Express templates, allows you to set port, catch errors, app path, statics the current directory, without all the boilerplate.
Downloads
18
Readme
####Quick-Server
Is a small web server stub for NodeJS/Express/Hogan and can be run directly or require'd into a script.
Uses Express, Hogan-Express templates, allows you to set port, catch errors, app path, statics the current directory, without all the boilerplate.
Allows use of server and client JS in the same script, separated by the delimiter /**/
Server code is loaded in, client code is usable by fetching the file renamed client-* instead of server-*.
###A single page web app
$ cd test
$ node myapp
require('quick-server')(function(options, app){
app.all('/', function(r,s){
...
})
})
JS files that start with server- are automatically required in. These files may contain client JS as well after the delimiter /**/
server-some.js
module.exports = function(options, app){
console.log('Hi, I am the server code');
}
/**/
function clientjs(){
document.write('Hi, I am written from client JS');
}
index.html
<script src='client-some.js'></script>
<script>
clientjs();
</script>
###Running the script directly
$ node server
or
$ apppath=./myapplication node server
###Options
$ errors=1 apppath=./myapppath port=8080 node server
$ errors=1 apppath=./myapppath port=8080 node myapp
// errors will set node to catch all uncaught application errors