Skip to content
This repository has been archived by the owner on Mar 13, 2020. It is now read-only.

conradkoh/express_route_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express route loader

This module generates a router from a folder, to allow easy implied route loading via directory structure.

Sample usage:

var RouteLoader = require('express_route_generator');
var router = RouterLoader.Attach('/', './routes');
var Express = require('express');
var App = Express();
App.use('/', router);
App.listen(8080, () => {
    console.log('listening');
})

Project structure

- routes  
    - home
        - router.js

Sample router.js

var Express = require('express');
var router = Express.Router();
router.use('/', (req, res) => {
    res.end('Welcome to the home page!');
});
module.exports = router;

Visit the page http://localhost:8080/home and you should see 'Welcome to the home page!'

About

Route generator to bind directories to a router

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published