Skip to content

FoxMonX/chimera

 
 

Repository files navigation

@netisu/chimera

code style: prettier

Netisu presents.....

Chimera 🦁 🐍 🐐

Use your AdonisJS named routes in your inertia frontend.

Installation

node ace add @netisu/chimera

node ace configure @netisu/chimera

Setup

Register a Named Route

Create a named route in your start/routes.ts file:

Route.get('users/:id', () => {
  ...
}).as('users.show');

Client-Side Usage

Getting the routes in your frontend

Compile your routes file by running

node ace chimera:generate

By default it will export your routes at

resources/js/chimera.ts

but you can change this inside of the chimera config (at config/chimera.ts).

Now you can use the Chimera helper to access your adonis routes:

import Chimera from 'resources/js/chimera';

Chimera.route('users.index'); // => `/users/1`

/**
 * You can also pass path params as an array and they will populated
 * according to their order:
 */
Chimera.route('users.show', { id: 1 }); // => `/users/1`

Checking the Current Route

import Chimera from 'resources/js/chimera';

Chimera.current('dashboard');

About

Use your AdonisJS named routes in your inertia frontend.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 95.8%
  • JavaScript 4.2%