Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
h1. Sinatra-REST
Actually it's a set of templates to introduce RESTful routes in Sinatra. The only thing for you to do is to provide the views. The routes and some url helpers will be provided behind the scenes.
h2. Installation
Guess what!
sudo gem source --add http://gems.github.com
sudo gem install blindgaenger-sinatra-rest
h2. Usage
Of course you need to require the gem in your Sinatra application:
require 'rubygems'
require 'sinatra'
require 'sinatra/rest'
It's very similar to defining routes in Sinatra (@get@, @post@, ...). But this time you don't define the routes by yourself, but use the model's name for convention.
For example, if the model's class is called @Person@ you only need to add this line:
rest Person
Which will add the following RESTful routes to your application. (Note the pluralization of @Person@ to the @/people/*@ routes.)
But the real benefit is, that these routes define a restful standard behaviour on your model, appropriate routing and redirecting and named url helpers.
For instance, you can imagine the following code to be added for the @/people@ and @/people/:id@ routes.
# simply add this line
rest Person, :renderer => :erb
# and this is generated for you
get '/people' do
@people = Person.all
erb :"people/index", options
end
put '/people/:id' do
@person = Person.find_by_id(params[:id])
redirect url_for_people_show(@person), 'person updated'
end
# further restful routes for Person ...
That's only half the truth! The routes are generated dynamically, so all defaults can be overridden (the behaviour, after/before callbacks, used renderer, which routes are added).
For more details and options, please have a look at the pages in the
"Sinatra-REST Wiki":http://github.com/blindgaenger/sinatra-rest/wikis on Github.
h2. Links
h2. Contact
You can contact me via mail at blindgaenger at gmail dot com, or leave me a message on my "Github profile":http://github.com/blindgaenger.
FAQs
Unknown package
We found that sinatra-rest 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.