<commit_before>[![Dependency Status](https://gemnasium.com/biggora/caminte-generator.png)](https://gemnasium.com/biggora/caminte-generator)
[![NPM version](https://badge.fury.io/js/caminte-generator.png)](http://badge.fury.io/js/caminte-generator)
## CaminteJS RestFul server

  Fast, unopinionated, minimalist restful server for [node](http://nodejs.org/) and [express](http://expressjs.com/) based on [caminte orm](http://www.camintejs.com/).

### CaminteJS ORM db adapters:
    mysql, sqlite3, postgres, mongodb, redis, riak, couchdb(nano), rethinkdb, tingodb

<table>
    <tr>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/memory.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/mongodb.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/mysql.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/postgresql.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/sqlite.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/mariadb.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/firebird.png"/></td>   
    </tr>
    <tr>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/couchdb.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/rethinkdb.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/redis.png"/></td> 
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/tingodb.png"/></td>      
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/neo4j.png"/></td> 
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/arangodb.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/cassandra.png"/></td>
    </tr>
</table>

## Installation

    $ npm install -g caminte-generator

## Quick Start

 The quickest way to get started with caminte-generator is to utilize the executable `cjs(1)` to generate an application as shown below:

 Create the app:

    $ npm install -g caminte-generator
    $ cjs -i test && cd ./test

 Install dependencies:

    $ npm install

 Edit `./config/index.js` file, to configure the connection to the database server.

 Create model:

    $ cjs -g User name email password desciption:text created:date

 Run server:

    $ cjs -s

#### Calling a REST server with Command Line cURL

 Create User:

    $ curl -X POST http://localhost:3000/v1/users -i -H "Content-type: application/json" -d "{\"name\":\"<NAME>\",\"created\":\"2014-01-01\"}"
    # or
    $ curl -X POST http://localhost:3000/v1/users -i -d "name=Alex%20Gora&created=2014-01-01"
 
 Update User:
 
    $ curl -X PUT http://localhost:3000/v1/users/1 -i -H "Content-type: application/json" -d "{\"pass\":\"<PASSWORD>\",\"email\":\"<EMAIL>\"}"
    # or
    $ curl -X PUT http://localhost:3000/v1/users/1 -i -d "pass=<PASSWORD>&email=<EMAIL>"

 Get Users:

    $ curl -X GET http://localhost:3000/v1/users -i -H "Content-type: application/json" -d "{\"skip\":\"0\",\"limit\":\"10\",\"sort\":\"id:desc\"}" 
    # or
    $ curl -X GET http://localhost:3000/v1/users -i -d "skip=0&limit=10&sort=id:desc" 

 Delete User:

    $ curl -X DELETE http://localhost:3000/v1/users/1 -i

 Search:
    
    $ curl -X GET http://localhost:3000/v1/users -i -H "Content-type: application/json"  -d "{\"search\":\"name:alex\"}"
    # or
    $ curl -X GET http://localhost:3000/v1/users -i -d "search=name:alex" 

### Usage

    $ cjs [options] [dir]

### Options

    -h, --help                  output usage information
    -V, --version               output the version number
    -i, --init <appname>        create caminte application
    -g, --generate <modelname]  generate data model
    -s, --server                runs caminte server
    -a, --adapter               database adapter (mysql|redis|etc...)
    -j, --jade                  add jade engine support (defaults to ejs)
    -H, --hogan                 add hogan.js engine support
    -c, --css <engine>          add css <engine> support (less|stylus|compass) (defaults to plain css)
    -f, --force                 force on non-empty directory

### Examples

    # create new restful application
    $ cjs -i Test -a mysql -j

    # create model
    $ cjs -g Post active:bool name:string desc:text created:date

### Routes

will provide the following routes:

    method        route                    action 
    ------------------------------------------------------------
    GET           /v1/:table                  index      
    GET           /v1/:table/:id              show       
    POST          /v1/:table                  create    
    PUT           /v1/:table/:id              update      
    DELETE        /v1/:table/:id              destroy    
    DELETE        /v1/:table                  destroyall  

### Directory structure
<commit_msg>feat: update readme<commit_after>[![Dependency Status](https://gemnasium.com/biggora/caminte-generator.png)](https://gemnasium.com/biggora/caminte-generator)
[![NPM version](https://badge.fury.io/js/caminte-generator.png)](http://badge.fury.io/js/caminte-generator)
## CaminteJS RestFul server

  Fast, unopinionated, minimalist restful server for [node](http://nodejs.org/) and [express](http://expressjs.com/) based on [caminte orm](http://www.camintejs.com/).

### CaminteJS ORM db adapters:
    mysql, sqlite3, postgres, mongodb, redis, riak, couchdb(nano), rethinkdb, tingodb

<table>
    <tr>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/memory.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/mongodb.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/mysql.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/postgresql.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/sqlite.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/mariadb.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/firebird.png"/></td>   
    </tr>
    <tr>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/couchdb.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/rethinkdb.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/redis.png"/></td> 
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/tingodb.png"/></td>      
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/neo4j.png"/></td> 
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/arangodb.png"/></td>
      <td><img width="100" src="https://github.com/biggora/caminte/raw/master/media/cassandra.png"/></td>
    </tr>
</table>

## Installation

    $ npm install -g caminte-generator

## Quick Start

 The quickest way to get started with caminte-generator is to utilize the executable `cjs(1)` to generate an application as shown below:

 Create the app:

    $ npm install -g caminte-generator
    $ cjs -i test && cd ./test

 Install dependencies:

    $ npm install

 Edit `./config/index.js` file, to configure the connection to the database server.

 Create model:

    $ cjs -g User name email password desciption:text created:date

 Run server:

    $ cjs -s

#### Calling a REST server with Command Line cURL

 Create User:

    $ curl -X POST http://localhost:3000/v1/users -i -H "Content-type: application/json" -d "{\"name\":\"<NAME>\",\"created\":\"2014-01-01\"}"
    # or
    $ curl -X POST http://localhost:3000/v1/users -i -d "name=Alex%20Gora&created=2014-01-01"
 
 Update User:
 
    $ curl -X PUT http://localhost:3000/v1/users/1 -i -H "Content-type: application/json" -d "{\"pass\":\"<PASSWORD>\",\"email\":\"<EMAIL>\"}"
    # or
    $ curl -X PUT http://localhost:3000/v1/users/1 -i -d "pass=<PASSWORD>&email=<EMAIL>"

 Get Users:

    $ curl -X GET http://localhost:3000/v1/users -i -H "Content-type: application/json" -d "{\"skip\":\"0\",\"limit\":\"10\",\"sort\":\"id:desc\"}" 
    # or
    $ curl -X GET http://localhost:3000/v1/users -i -d "skip=0&limit=10&sort=id:desc" 

 Delete User:

    $ curl -X DELETE http://localhost:3000/v1/users/1 -i

 Search:
    
    $ curl -X GET http://localhost:3000/v1/users -i -H "Content-type: application/json"  -d "{\"search\":\"name:alex\"}"
    # or
    $ curl -X GET http://localhost:3000/v1/users -i -d "search=name:alex" 

### Usage

    $ cjs [options] [dir]

### Options

    -h, --help                  output usage information
    -V, --version               output the version number
    -i, --init <appname>        create caminte application
    -p, --prefix <prefix>       api url prefix defaults v1
    -g, --generate <modelname]  generate data model
    -s, --server                runs caminte server
    -a, --adapter               database adapter (mysql|redis|etc...)
    -j, --jade                  add jade engine support (defaults to ejs)
    -H, --hogan                 add hogan.js engine support
    -c, --css <engine>          add css <engine> support (less|stylus|compass) (defaults to plain css)
    -f, --force                 force on non-empty directory

### Examples

    # create new restful application
    $ cjs -i Test -a mysql -j

    # create model
    $ cjs -g Post active:bool name:string desc:text created:date

### Routes

will provide the following routes:

    method        route                    action 
    ------------------------------------------------------------
    GET           /v1/:table                  index      
    GET           /v1/:table/:id              show       
    POST          /v1/:table                  create    
    PUT           /v1/:table/:id              update      
    DELETE        /v1/:table/:id              destroy    
    DELETE        /v1/:table                  destroyall  

### Directory structure

{'fraction_non_alphanumeric': 0.1829983652274257, 'fraction_numerical': 0.02375228387344937, 'mean_word_length': 2.3854166666666665, 'pattern_counts': {'":': 16, '<': 118, '<?xml version=': 0, '>': 116, 'https://': 34, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, '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': '6024576', 'n_tokens_mistral': 3680, 'n_tokens_neox': 3471, 'n_words': 738}