ApiPush is a simple app that lets anyone easily publish an API without writing any code - think Heroku for public apis. Each api is represented by a json file, which makes publishing is a snap: apipush path/to/config.json.

ApiPush supports all the stuff you probably need to wrap existing services in an api, including both HTTP and Websockets support, dynamic queries thanks to handlebars templates and helpers, and more.

Here’s a short example.

When we query the below api, it will return the title of http://google.com which happens to always be “Google”. (Hey, it’s repeatable.) I’ve added some comments to explain what’s going on in the JSON below. If you’re interested you can give it a try yourself here.

{
  "name": "The title of Google is....",
  "versions": { // Specify multiple major versions
    "v1": {
      "routes": [ // A list of all routes contained in this version
        {
          "accept": { // 1. When we perform a GET /...
            "method": "GET",
            "url": "/"
          },
          "proxy": { // 2. Send a request to http://google.com...
            "via": "http",
            "method": "GET",
            "url": "http://google.com",
            "responses": {
              "success": { // 3. Then, return the formatted title.
                "contains": "Google",
                "then": "{\"success\": true, \"title\": \"{{jquery_text 'title'}}\"}"
              },
              "fail": { // 4. If the request fails...
                "contains": "",
                "then": "{\"success\": false, \"title\": null}"
              }
            }
          }
        }
      ]
    }
  }
}

How did you make it?

ApiPush is written in Node.js and Express, using MongoDB as a database. Check out ApiPush on Github here.

Also, since I only wrote it in (about) a week, I only have 85% test coverage. I’m planning on, with future projects, getting that number higher though.

How can I give it a try?

First, install the cli tool:

$ npm install --global apipush

Then, create and push up an api:

$ apipush init api.json
$ # (make any edits)
$ apipush api.json
Welcome!
Please login or create an account by entering an email and a password:
Email Address: user@example.com
Password for user@example.com: ********
... Loaded api docs from api.json
... Published by user@example.com

... Api sleepy-train-army been provisioned!
... Check out your new api at http://apipush.apps.rgaus.net/sleepy-train-army/api/v1
... (and, get metadata information at http://apipush.apps.rgaus.net/sleepy-train-army/api/v1/_meta.json

Try appending ?name=bob to the end of the api above to see dynamic queries in action.

If you’d like to know more about all the possible options, I’ve a lot more documentation in the README.