
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
= Sinatra::Mapping
Map easily URLs in your Web applications.
The extension Sinatra::Mapping is a minimal module that is useful for create map names for {Ruby}[http://www.ruby-lang.org] {Sinatra}[http://www.sinatrarb.com] web applications.
== Getting start
Install stable version gem from {RubyForge.org}[http://www.rubyforge.org/]:
gem install sinatra-mapping
Or, install development version gem from {GitHub.com}[http://github.com/]:
gem install hallison-sinatra-mapping --source http://gems.github.com
== How to use
Sinatra implements REST routes:
get '/' do .. show something .. end
post '/' do .. create something .. end
put '/' do .. update something .. end
delete '/' do .. annihilate something .. end
For improve this routes use extension by registered method in the main source of application. To better understand, copy and paste the following example in {Ruby}[http://www.ruby-lang.org] source file +weblog.rb+:
#!/usr/bin/env ruby require 'rubygems' require 'sinatra' require 'sinatra/mapping' # only this line for use mapping!
map :root, "blog" # /blog/ map :entries, "posts" # /blog/posts map :tags, "labels" # /blog/labels
mapping :entry => "posts/:entry_id", # /blog/posts/id-for-post :entry_comments => "posts/:entry_id/comments", # /blog/posts/id-for-post/comments :tagged_entries => "labels/:tag_id/entries" # /blog/labels/id-for-tag/entries
get root_path do <<-end_content
get entries_path do <<-end_content
#{link_to "Back", :root}
end_content endget tags_path do <<-end_content
#{link_to "Back", :root}
end_content endget entry_path do |entry_id| title = entry_id.gsub('-',' ').capitalize <<-end_content
It works!
#{link_to "Back", :root} | #{link_to "Comments", :entries, entry_id, 'comments'}
end_content endget entry_comments_path do |entry_id| title = entry_id.gsub('-',' ').capitalize <<-end_content
It works and show comments for "#{title}".
#{link_to "Back", :root}
end_content endget tagged_entries_path do |tag_id| <<-end_content
It works and show all entries tagged with "#{tag_id}".
#{link_to "Back", :root}
end_content endRun:
$ ruby weblog.rb -p 3000
Open Web browser http://localhost:3000/blog/ and look ... it works!
== Copyright
:include:LICENSE
FAQs
Unknown package
We found that sinatra-mapping demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.