
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
AutoApi generates a RESTful API on the fly. If you call gets on items that do not exist, you get back what you'd expect if the object didn't exist. If you POST to something, even if it doesn't exist, it will create it on the fly, which then can be retreived from the database. It runs on Sinatra and MongoDB.
You just start calling endpoints and it just works. It’s pretty useless if you start off by making GET requests. You just get back empty arrays or 404s. However, start storing anything you want at all and then when making GET reqeusts, you will received the appropriate objects.
AutoApi handles all the normal RESTful single level routes, for example:
GET /forums
GET /forums/asdf1234
POST /forums #forum created with reqeust.POST data
PUT /forums/asdf1234 #forum asdf1234 updated with request.POST data
DELETE /forums/asdf1234 #deletes forum asdf1234 (note: related data is not cleaned up at this point)
DELETE /forums #deletes ALL forums (note: related data is not cleaned up at this point)
AutoApi will handle nested calls for GET (list), POST, and DELETE (list) for example:
GET /forums/asdf1234/topics
POST /forums/asdf1234/topics #a new topic is created from request.POST and associated to forum asdf1234
DELETE /forums/asdf1234/topics #deletes all the topics for the forum (note: data related to the deleted topics is not cleaned up at this point)
Note: forums and topics are used it this example, but topics could have posts. Or you could use this for user data or really whatever else you want a RESTful interface for. I can see this being great for rapid front-end prototyping.
Add this line to your application's Gemfile:
gem 'auto_api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install auto_api
- MongoDB
- Rename config/mongoid.yml.example to config/mongoid.yml
- Make whatever changes to the config file to work in your environment
Add the following to your config.ru file:
require 'auto_api'
map '/api' do #can use whatever path or add version or anything since this is modular
run AutoApi::Base
end
There are many things I see going into this in the future. My first priorities are:
- Destroy orphaned data in the database
- Destroy objects that no longer contain data in the DB to free memory
- Enable the ability to run in a “mock” environment which cleans up after every call.
- Any other useful features that emerge as I developing and using it
- note: requests are always welcome (especially pull requests)
This is currently in a prototype/alpha phase.
In order to get this out in the wild as soon as possible, I am pusing the prototype. Full tests/specs are to come in the very near future.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that auto_api 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.