API documentation is on the wiki
This is Outpost's public API component.
It's a simple Node.js app which queries information from a MongoDB collection and publishes it as a read-only, rate-limited REST API.
It's not useful by itself — it depends on a public index built by Outpost. The API it outputs is consumable by Scout.
You need Node.js, npm and a working MongoDB database with the right indices available on localhost:27017
.
npm i
npm run dev
By default it will be on localhost:5000/api/v1/services
.
It's suitable for 12-factor hosting like Heroku. It has a Procfile that will make sure the proper MongoDB indices are set up.
npm start
It expects a few environment variables.
DB_URI
overrides the defaultlocalhost:27017/outpost_development
MongoDB connection URI.GOOGLE_API_KEY
used for geocoding fromlocation=
parameters. Needs the geocoding API enabled.
It needs the right indices on the MongoDB collection to enable full-text and geo search. Something like:
db.indexed_services.createIndex({ name: "text", description: "text" })
db.indexed_services.createIndex({ "locations.coordinates": "2dsphere" })
You can create these two automatically with the npm run prepare-indices
command.