<commit_before># Esapiserver

A very lightweight Sinatra/MongoDB CRUD API server to be used for EmberJS development and testing. By using MongoDB as the database server, all the tables are created on the fly when POST requests are made, in other words, no tables needs to be created beforehand. 

## 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 a collection of a selected db
		http://localhost:4567/db_collections
	
	
POST request:

	Creates a new thing
		http://localhost:4567/api/:thing
	
	
GET requests:

	Returns a list of things
		http://localhost:4567/api/:thing
	
	Returns a list of things that matches a specific query
		http://localhost:4567/api/:thing?ids[]=id1&ids[]=id2
	
	Returns a thing with a specific key/value
		http://localhost:4567/api/:thing?key=value
		
	Returns a thing with a specific id
		http://localhost:4567/api/:thing/:id
	
DELETE request:

	Deletes a thing with a specific id
		http://localhost:4567/api/:thing/:id
	
PUT request:

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

EmberJS

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

## Contributing

1. Fork it ( https://github.com/[my-github-username]/esapiserver/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request<commit_msg>Updated the README<commit_after># Esapiserver

A very lightweight Sinatra/MongoDB CRUD API server to be used for EmberJS development and testing. By using MongoDB as the database server, all the tables are created on the fly when POST requests are made, in other words, no tables needs to be created beforehand. 

## 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 a collection of a selected db
		http://localhost:4567/db_collections
	
	
POST request:

	Creates a new thing
		http://localhost:4567/api/:thing
	
	
GET requests:

	Returns a list of things
		http://localhost:4567/api/:thing
	
	Returns a list of things that matches a specific query
		http://localhost:4567/api/:thing?ids[]=id1&ids[]=id2
	
	Returns a thing with a specific key/value
		http://localhost:4567/api/:thing?key=value
		
	Returns a thing with a specific id
		http://localhost:4567/api/:thing/:id
	
DELETE request:

	Deletes a thing with a specific id
		http://localhost:4567/api/:thing/:id
	
PUT request:

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

EmberJS

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

{'fraction_non_alphanumeric': 0.08568075117370892, 'fraction_numerical': 0.03198356807511737, 'mean_word_length': 3.398709677419355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3885014', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1079, 'n_words': 372}