0.0.20 • Published 7 years ago

omuen v0.0.20

Weekly downloads
34
License
MIT
Repository
github
Last release
7 years ago

router

How to start?

var omuen = require('omuen');
var app = omuen.handle(function(request, response){
  response.end("oMuen, It's works!");
});
app.listen(10100);

How to add a handler

EZ-MODE: http://example.com/hello.do

var omuen = require('omuen');
var app = omuen.handle(function(request, response){
  response.end("oMuen, It's works!");
});

app.get("hello.do", function(request, response){  
    var text = "Hello, World!";  
    response.end(text);  
});  
app.listen(10100);

or with "get" and "post" to http://example.com/hello.do

var omuen = require('omuen');
var app = omuen.handle(function(request, response){
  response.end("oMuen, It's works!");
});

app.push("hello.do", omuen.handle({ 
  doGet: function(request, response){ 
    var data = "[GET] Hello, World!"; 
    response.setHeader('Content-Length', data.length); 
    response.end(data); 
  },
  doPost: function(request, response){  
    var data = "[POST] Hello, World!";  
    response.setHeader('Content-Length', data.length);  
    response.end(data);  
  }  
}));   
app.listen(10100);

You can also

var omuen = require('omuen');
var app = omuen.handle(function(request, response){
  response.end("oMuen, It's works!");
});

app.get("hello-get.do", function(request, response){ 
  var data = "[GET] Hello, World!"; 
  response.end(data); 
});
app.post("hello-post.do", function(request, response){  
  var data = "[POST] Hello, World!";  
  response.end(data);  
});   
app.listen(10100);

or with "sub-handler" http://example.com/hello/hello-world.do and http://example.com/hello/hi-man.do

var omuen = require('omuen');
var app = omuen.handle(function(request, response){
  response.end("oMuen, It's works!");
});

var hello = omuen.handle();
hello.push("hello-world.do", function(request, response){
  var data = "hello, World";
  response.end(data);
});
hello.push("hi-man.do", function(request, response){
  var data = "Hi, Man!";
  response.end(data);
});

app.push("hello", hello);
app.listen(10100);

How to install

npm install omuen

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.1

7 years ago