Api-server-js is a project mainly written in JAVASCRIPT and RUBY, it's free.
API server for Linjekoll, built with node.js, express and validator
Handles:
A live server can be found here.
Start by cloning the project.
git clone [email protected]:linjekoll/api-server-js.git
Navigate to the downloaded folder and run bundler.
cd api-server-js && bundle install
Start the server by running foreman start
.
Ingoing data.
{
event: "event",
next_station: 8998235,
previous_station: 898345,
arrival_time: 1318843870,
alert_message: "oops!",
line_id: 2342
}
station_id
.station_id
.next_station
? This should be a unix time stamp.null
.line_id
.Returns 204 if everything went okay, otherwise 400.
An 400 request returns this data.
{
valid: false
errors: ["id is not a valid int"]
}
Just a heartbeat.
{
event: "event",
next_station: 8998235,
previous_station: 898345,
arrival_time: 1318843870,
alert_message: "oops!",
line_id: 2342
provider_id: 123123,
journey_id: 123123
}
Here we're using the same attributes as above.
Install node.js ~> 0.4.12 and npm.
Then install dependencies and run the server by typing:
npm install -d && node app.js
.
Routes:
PUT: /:api_key/providers/:provider_id/journeys/:journey_id
/pop
- get the pending job from beanstalk
/push
- push a dummy job into beanstalk