1.0.5 • Published 4 years ago

rob-router v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

rob-router

Overview

For non-SPA client side routers for WEB applications.

Description

Define the routes file, The controller matching the URL is executed.

Usage

Install

npm install rob-router

Demo

# routes
import RobRouter from 'rob-router';
import users from './users_controller';

const router = new RobRouter({
  controllers: {
    users
  },
  routes: {
    '/': 'users#root',
    'users(/)': 'users#index',
    'users/:userId': 'users#show',
    'users/:userId/posts(/)': 'users#posts',
    'users/:userId/posts/:postId(/)': 'users#postShow'
  }
});

router.run(location.href);
# user_controller
export default {
  root: () => {},
  index: () => {},
  show: userId => {},
  posts: userId => {},
  postShow: (userId, postId) => {}
};

Licence

MIT

Author

orangemittoo

1.0.5

4 years ago

1.0.1

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago