Ys
Node.js micro web framework.
Installation
npm install ys
Hello World:
var Ys = Ys; { res;}; Ys;
In debug mode the server reloads itself on source changes. Do not use in production.
API:
Server Run Params
Ys;
Generic Response
{ res; res;};
JSON Response
get{ res;};
Templating
// return html response using template 'hello.html' // (default template engine is 'handlebars.js' but any template engine with a 'compile' method can be defined)// Where 'hello.html' is:// <h1>Hello {{name}}!</h1>gettemplate = { res;};
Echo Server
{ res;};
Static Files
//return static filesgetstatic = "."; //return gzipped file (depends on client's accept encoding)getgzip = ".";
Redirect
redirect = "$1/";//adds a trailing slash when missing
Rewrite
//rewrite /json_alias/ to /json/// must appear before the /json/ routerewrite = "/json/"; get{ res;};
Proxy
//proxy all requests to http://localhost:8080/proxy = "http://localhost:8080/";
Running Multiple Instances
var a= Ys b = Ys; get{ res;};a; get{ res;};b;