0.2.5 • Published 7 years ago

routes-generator v0.2.5

Weekly downloads
40
License
MIT
Repository
-
Last release
7 years ago

routes-generator.js

REST like URL routes generator for frontend (for react-router etc)

Install

npm install routes-generator

Usage

import { both, collection, member, routes } from "routes-generator";

const r = routes({
    config: collection({
        flag: collection(),
    }),
    items: both(
        collection({
            new: collection(),
        }),
        member({
            edit: collection(),
        }),
    ),
    users: both(
        collection(),
        member(),
    ),
});

console.log(r.config().flag()); // "/config/flag"
console.log(r.items().toString()); // "/items"
console.log(r.items(1).toString()); // "/items/1"
console.log(r.items().new()); // "/items/new"
console.log(r.items(1).edit()); // "/items/1/edit"

With TypeScript

  • You can change the path by IDE(VSCode etc.)'s symbol change function.
  • You can easily complement the path with IDE.

License

This is released under MIT License.

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago