Git Product home page Git Product logo

express_treestyle_router's Introduction

express_treestyle_router


For a routes show as followed

root
 |--api
    |--doA
        |--doA0
        |--doA1
    |--doB
 |--dir
    |--viewA
    |--viewB
        |--viewB0

Instead of

app.get('/',Home_controller.showHome);
app.post('/api/doA',A_controller.doA);
app.post('/api/doA/doA0',A_controller.doA0);
app.post('/api/doA/doA1',A_controller.doA1);
app.post('/api/doB',B_controller.doB);
app.get('/dir/viewA',A_controller.showA);
app.get('/dir/viewB',B_controller.showB);
app.get('/dir/viewB/viewB0',B_controller.showB0);

You are able to

const router = require('express_treestyle_router')(app);
router.add('/','get',Home_controller.showHome);
const api = router.newDir('api');
    api.add('doA','post',A_controller.doA);
    const doA = api.newDir('doA')
        doA.add('doA0','post',A_controller.doA0);
        doA.add('doA1','post',A_controller.doA1);
    api.add('doB','post',B_controller.doB);
const dir = router.newDir('dir');
    dir.add('viewA','get',A_controller.showA);
    dir.add('viewB','get',B_controller.showB);
    const viewB = dir.newDir('viewB');
        viewB.add('viewB0','get',B_controller.showB0);

express_treestyle_router's People

Contributors

fa93hws avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.