Running both at the same time normal mode and API mode in Rails

Hi there, I am playing around with Rails and asked me, if i can use Rails in normal mode for the Backend and in the API mode for the Frontend.

Is there any solution for that?

Hi Piet,

Can you explain what you are actually trying to do? What you are describing sounds like just using full Rails, rather than using it in API mode.

Rails, by default, is setup to be full stack. API mode turns it into only a backend (which is the opposite of what you are asking for), which allows you to create a client application to consume your Rails API. This client application would generally be something created with react, svelte, angular, etc.

I’m not sure if I helped or not, but hopefully I did!

1 Like

Hi Brandon, thanks for your answer. I think i found the correct answer by myself.

For the Backend i use the standard way with views and for the Frontend i can render the output via jBuilder as json. That works fine for me.

Is this the right way to solve my issue?

It sounds like you have a mix of a “client app” (react, angular, or something similar) consuming the json, along with static views rendering other pages? If so, I usually do the same thing you described. Good job :slight_smile:

1 Like

@brandoncc Exactly. Well, then I am glad that this path seems to be a good one :slight_smile: