Closed postmodern closed 11 months ago
Currently moving /db/*
routes outside of a app.rb
would be enough.
I though about moving scanning
section (nmap
, masscan
, recon
, vulns
, spider
) also, but it not as huge as db
.
I was wondering if we should create db_routes.rb
file in root directory or maybe api/db.rb
or routes/db.rb
? (I think creating additional namespace requires changes in views directory structure)
Beside moving db
, we could consider making it more compact. Most of these routes are repeatable so we could define them similar to what we did for notes
.
Hmm.. maybe instead of creating new class for db
we should just "compact" them as I mentioned before?
But on the other side It might be much less readable..
Another downside would be that if we split apart the app into multiple apps, the /db/
app would still be giant, as that is where the majority of the routes are.
A simpler alternative to using Sinatra::Router
, would be to just open up the class again in multiple files.
app.rb
:
class App < Sinatra::Base
...
end
require './app/db'
require './app/scanning'
app/db.rb
:
class App < Sinatra::Base
get '/db/...' do
...
end
end
Yeah let's split the app.rb
file apart by just re-opening the App
class. I will make a new issue.
The
app.rb
file is getting quite large. Perhaps we could use Sinatra::Router to split up theApp
class into multiple sub-App classes that are routed together?