🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

webwork

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webwork

restfull api gate app framework

npmnpm
Version
0.1.0
Version published
Weekly downloads
1
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Installation

$ npm install webwork

Hello webwork

//use shared webwork instance and bind any http method to any url
require('webwork').bind('/*',function(req,resp){
	resp.end('Hello webwork');
}).start(8080)
//new webwork instance
const webwork = require('webwork');
const app = new webwork();

//bind default view resolver
var LiteEngine = require('lite');
var engine = new LiteEngine('./');
app.resolveView('*.xhtml',engine.render.bind(engine))

//bind get http method for any url and output model as json
app.bind('/resource/:id').get(function(req,resp){
  this.title = 'Hello Webwork';
  this.body = 'resource id:'+req.params.id;
});

//bind get http method for any other url and use template: 'success.xhtml'
app.bind('*').get(function(req,resp){
  this.title = 'Hello Webwork';
  this.body = 'url path:'+req.params[0];
  return '/success.xhtml'
});

app.start();

Keywords

web

FAQs

Package last updated on 23 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts