Coder Social home page Coder Social logo

Comments (4)

soveran avatar soveran commented on May 22, 2024

Hey @rhymes, I'm afraid it's a very difficult (or impossible!) task. In Rails, the routes are compiled and can be observed later. What you get in that list is something like the following:

users GET    /users(.:format)          users#index
      POST   /users(.:format)          users#create

In that list, you only see the REQUEST_METHOD and the path matcher. In Cuba, you can match against anything, and you can nest the routes in different ways. Because of that, building a list of routes is as difficult as building a list of possible matches for an arbitrary regular expression. As that list is infinite, there's no simple way to create a user friendly representation. I won't close the issue right away so that others can participate and share their point of view.

from cuba.

rhymes avatar rhymes commented on May 22, 2024

@soveran I understand. Thanks for the explanation.

Do you think that keeping a compiled list of the matchers benefits speed in Cuba's case? Maybe we can just print those.

from cuba.

F-3r avatar F-3r commented on May 22, 2024

This is perhaps kind of a "caveman approach", but perhaps is transformable into a good idea?

We ussually have our cuba apps under /apps dir. Using grep like:

grep -rn "on\ .*do " apps/*

we get:

#...
apps/app.rb:10:              on put, ':id/edit' do |id|
apps/app.rb:14:              on ':id/configuration' do |id|
apps/app.rb:24:                 on put, param(:data) do |data|
apps/app.rb:44:                 on post, param(:data) do |data|
apps/app.rb:50:                 on put, ':id/recover' do |id|
#...

Not as fancy as rake routes, but definetely faster :P

from cuba.

soveran avatar soveran commented on May 22, 2024

I'm closing this issue, but I recommend reading this thread: soveran/syro#18

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.