JavaScript has suffered from the lack of good tooling for a long time, when seeking to map your client-side code towards server-side logic, and retrieving data. The security issues here too, have historically been a nightmare. To combat this problem, I set out to create an HTTP REST based generic ORM set of services, which allows you to generically do all for basic CRUD operations for MySQL; select, delete, update and insert of course.

It is built such that each separate operation has its own unique URL. This has a lot of benefits, since it’s easy to grant or deny access to some resource, and discriminate access clearance, according to the URL, and the user’s role. But first, let’s talk about our 4 different operations.

Select example

You can easily perform a select type of query, through an HTTP GET request, which again will return some JSON object, containing the results of your query. Pass in criteria for your select as query parameters, and you can decorate it easily. Below is an example.


The above will retrieve 10 items from the “your-database” database, and its “your-table” table. It will order the results by the “name” column, and select from the 50th item and out. It will return a JSON array, containing only the “name” and the “email” columns. Since it is very easy to assign access right to a virtual URL such as the above in Phosphorus Five, this allows you to assign access right to users, according to their roles.

In addition to “select” queries, you can also do “insert”, “update” and “delete” – And it will generically work, regardless of your database schema, towards any table, allowing you to apply a whole range of parameters, filtering your end results one way or another. If you want to select only items that are beyond the name of “Hansen” for instance, you can add a where clause, using the >= operator, as a part of your HTTP GET query.

You can find the project here. Notice, it’s currently in ALPHA state …

You can see a video of me demonstrating it below. The project contains some sample code, which you can probably easily modify to serve your own needs.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.