Coder Social home page Coder Social logo

Comments (2)

soveran avatar soveran commented on May 22, 2024 1

Hi @ezekielriva! I understand what you want to do: you would like to embed all the routes defined in V1::Settings and V1::Setups. The way run works is it just handles over the control to the sub app, so it halts the request no matter what happens inside this other app. We can try something to see if it works for your use case. Try adding this code:

class Cuba
  def mount(app)
    result = app.call(req.env)
    halt result if result[0] != 404
  end
end

Then, in your application, you can use it like this:

Cuba.define do
  on default do
    mount A 
    mount B
  end
end

It should halt the request only if the resulting status from calling the mounted app is not 404. If you run into unexpected issues, let me know and I'll try to fix the implementation. If it all works, we can write a plugin that provides this code.

Let me know how it goes!

from cuba.

soveran avatar soveran commented on May 22, 2024

@ezekielriva I moved this explanation to the README. Thanks a lot for inspiring this idea :-)

from cuba.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.