0.0
No commit activity in last 3 years
No release in over 3 years
A Sinatra/MongoDB API server to use for EmberJS development
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
~> 1.8.1
~> 1.10.2
~> 1.4.5
 Project Readme

Esapiserver

A very lightweight Sinatra/MongoDB CRUD API server to be used for EmberJS development and testing.

I started out using the fixture and local storage adapters in Ember, but experienced that the limitations that these adapters have, would turn out be a pain later when it was time to release my app - I wanted to make sure that what I test, was consistant with what I would release, hence the esapiserver.

Installation

Run:

Install the gem
	$ gem install esapiserver

Start up your mongoDB server   
	$ mongoD
	
Start the Ember Sinatra/MongoDB API server
	$ easapiserver

Usage

Database related requests:

Load a db
	http://localhost:4567/select_db/ember_test_db
	
Reset a db - this will drop and reload the DB
	http://localhost:4567/reset_db/ember_test_db
	
List the collections of the selected db
	http://localhost:4567/db_collections

POST request:

Creates a new model
	http://localhost:4567/api/:model

GET requests:

Returns a list of models
	http://localhost:4567/api/:model

Returns a list of models that matches a specific query
	http://localhost:4567/api/:model?ids[]=id1&ids[]=id2

Returns a model with a specific key/value
	http://localhost:4567/api/:model?key=value
	
Returns a model with a specific id
	http://localhost:4567/api/:model/:id

DELETE request:

Deletes a model with a specific id
	http://localhost:4567/api/:model/:id

PUT request:

Updates a model with a specific id
	http://localhost:4567/api/:model/:id

EmberJS

App.ApplicationAdapter = DS.RESTAdapter.extend
	namespace: 'api'
	host: 'http://127.0.0.1:4567'
	corsWithCredentials: true