
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
@jimengio/router-code-generator
Advanced tools
> Router controller code generated of [ruled-router](https://github.com/jimengio/ruled-router).
Router controller code generated of ruled-router.
Live version: http://fe.jimu.io/router-code-generator
yarn add --dev @jimengio/router-code-generator
import { generateTree } from "@jimengio/router-code-generator";
generateTree(jsonRules);
[{ "name": "a", "path": "a" }]
export let genRouter = {
a: {
name: "a",
raw: "a",
path: () => `/a`,
go: () => switchPath(`/a`),
},
};
[
{
"name": "a",
"path": "a/:code"
}
]
export let genRouter = {
a_: {
name: "a",
raw: "a/:code",
path: (code: string) => `/a/${code}`,
go: (code: string) => switchPath(`/a/${code}`),
},
};
[
{
"name": "a",
"path": "a",
"queries": ["a", "b"]
}
]
export let genRouter = {
a: {
name: "a",
raw: "a",
path: (queries?: IGenQueryA) => `/a?${qsStringify(queries)}`,
go: (queries?: IGenQueryA) => switchPath(`/a?${qsStringify(queries)}`),
},
};
export interface IGenQueryA {
a?: string;
b?: string;
}
[
{
"name": "a",
"path": "a",
"next": [
{
"name": "b",
"path": "b"
}
]
}
]
export let genRouter = {
a: {
name: "a",
raw: "a",
path: () => `/a`,
go: () => switchPath(`/a`),
b: {
name: "b",
raw: "b",
path: () => `/a/b`,
go: () => switchPath(`/a/b`),
},
},
};
generateTree(jsonRules, { addTypes: true });
[
{
"path": "a",
"queries": ["a"],
"next": [
{
"path": "b",
"queries": ["a", "b"]
},
{
"path": "d"
}
]
}
]
export type GenRouterTypeMain = GenRouterTypeTree["a"];
export interface GenRouterTypeTree {
a: {
name: "a";
params: {};
query: { a: string };
next: GenRouterTypeTree["a"]["b"] | GenRouterTypeTree["a"]["d"];
b: {
name: "b";
params: {};
query: { a: string; b: string };
next: null;
};
d: {
name: "d";
params: {};
query: { a: string };
next: null;
};
};
}
MIT
FAQs
> Router controller code generated of [ruled-router](https://github.com/jimengio/ruled-router).
The npm package @jimengio/router-code-generator receives a total of 7 weekly downloads. As such, @jimengio/router-code-generator popularity was classified as not popular.
We found that @jimengio/router-code-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.