Building with AdonisJS & Inertia #2.9

What Code Can & Can't Be Shared Between AdonisJS & Inertia

In This Lesson

We'll discuss what code we can and cannot share between AdonisJS and Inertia.

Created by
@tomgobich
Published

Join the Discussion 4 comments

Create a free account to join in on the discussion
  1. @nonwiz

    Just wondering what's the clean way (if possible) to have a function that can be reused in both inertia scope and adonisjs scope. For example Enum that created at `/app/enums/…ts`, how do I make it possible so I can call it from my inertiajs scope. For now, I alway copy it twice to put under inertia just so i can use it.

    1
    1. Responding to nonwiz
      @tomgobich

      Hi nonwiz! As we did with the service in this lesson, you can import and use enums directly inside your frontend. It'll then be bundled with the frontend code when you build it.

      1
      1. Responding to tomgobich
        @nonwiz

        Thank tom!

        1
        1. Responding to nonwiz
          @tomgobich

          Anytime, nonwiz!!

          1