Skip to content

wxy2ab/routeloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a router loader middleware for express.js


####code reside in routeloader folder #####require express.js and sugar.js


 just load it like this
 > var express = require('express')
 > var app = express();
 >
 > var loader = require('./routeloader');
 > //load a directory
 > app.use(loader.loadpath('./Controllers'));

ok

then

under Controllers dir you may have a file like this

 //test1.js
 exports.hello=function(a,b){
    return parseInt(a)+parseInt(b);
};
exports.str=function(){
    return 'school';
}

and here we go light up your app and vist this url http://host/[filename]/[methodname]

http://localhost/test1/hello

About

route loader for express.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published