GithubHelp home page GithubHelp logo

codeforamerica / mongoprox Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 3.0 112 KB

A proxy server for any MongoHQ instances REST API.

Home Page: http://mongoprox.herokuapp.com/databases/?limit=10

JavaScript 100.00%

mongoprox's Introduction

Open311 Analytics Proxy Server

Mou icon

What is the meaning of this?

Open311 Analytics is powered by a MongoHQ MongoDB. As such, there is a RESTful API provided by MongoHQ that allows for a more expressive means of querying Open311 data as compared to using a raw Open311 endpoint. This is because Open311 as a specification is focused more on request input by citizens and less on data reading and analysis.

This proxy server is used to insulate the MongoHQ instance (and private account information) from users of the service.

This project is in beta and may change significantly in the future!

Setup and Deployment

The proxy server is easy to run locally and deploy to Heroku. You will need to have node and npm installed on your machine before continuing however. For Heroku, you will need to have a Heroku account - this app can run in the free tier.

Running locally

Clone the project:

$ git clone [email protected]:codeforamerica/mongoprox.git 

Go to the proxy directory and install the dependancies:

$ cd mongoprox 
$ npm install

Run the application like this:

APIkey=your_mongohq_api_key node proxy.js

Note: You can also set the APIkey environment variable by exporting it or, if you are using foreman, you can create a .env file.

Deploy to Heroku

Create a Heroku app and repo:

$ heroku create [app-name] --stack cedar

Set the APIkey environment variable on the Heroku app instance:

$ heroku config:add APIkey=your_mongohq_api_key

Push to the heroku repo and spin up the web worker:

$ git push heroku master
$ heroku ps:scale web=1

You should now be able run queries against your MongoHQ database using the REST API.

Usage

Whether running locally or on heroku, you pass MongoHQ API queries (you can use the other features like sort, too) like normal except you append the call parameters to your local or Heroku host and DO NOT include the apikey param.

For example:

On Heroku:
http://mongoprox.herokuapp.com/databases/chicago/collections/requests/documents?limit=1
Localhost:
http://localhost:3000/databases/chicago/collections/requests/documents?limit=1

mongoprox's People

Contributors

boundsj avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.