<commit_before>node-odata
==========
Create awesome REST APIs abide by [OData Protocol v4](http://www.odata.org/).  Its purpose is to easier to creating APIs, make you more focus on business logic.

  [![NPM Version](https://img.shields.io/npm/v/node-odata.svg?style=flat)](https://www.npmjs.org/package/node-odata)
  [![Build Status](https://img.shields.io/travis/TossShinHwa/node-odata.svg?style=flat)](https://travis-ci.org/TossShinHwa/node-odata)
  [![License](http://img.shields.io/npm/l/node-odata.svg?style=flat)](https://github.com/TossShinHwa/node-odata/blob/master/LICENSE)

```
var express = require('express'),
    odata = require('node-odata');
var app = express();

app.use(express.bodyParser());
app.use(express.query());

odata.set('app', app);
odata.set('db', 'mongodb://localhost/my-app');
odata.resources.register({ url: '/books', model: { title: String, price: Number } });

app.listen(3000);
```

Registers the following routes:

```
GET    /odata/books
GET    /odata/books/:id
POST   /odata/books
PUT    /odata/books/:id
DELETE /odata/books/:id
```

Use the following OData query:

```
Example
GET /books?$select=title, author
GET /books?$top=3&$skip=2
GET /books?$orderby=price desc
GET /books?$filter=price gt 10
GET ...
```

Try it:

* GET [/books?$select=title, author](http://books.zackyang.com/odata/books?$select=title, author)
* GET [/books?$top=3&$skip=2](http://books.zackyang.com/odata/books?$top=3&$skip=2)
* GET [/books?$orderby=price desc](http://books.zackyang.com/odata/books?$orderby=price desc)
* GET [/books?$filter=price gt 10](http://books.zackyang.com/odata/books?$filter=price gt 10)

## Current State

node-odata is currently at an alpha stage, it is stable but not 100% feature complete. node-odata is written by CoffeeScript then compiled to Javascript. It currently have to dependent on Express, MongoDB and mongoose yet. The current target is to remove the dependents then add more features.

## Install

```
npm install node-odata
```


## APIs

* [resources.register(params)](https://github.com/TossShinHwa/node-odata/wiki/1.resources.register(params))
* [functions.register(params)](https://github.com/TossShinHwa/node-odata/wiki/2.functions.register(params))
* [set(key, value)](https://github.com/TossShinHwa/node-odata/wiki/3.set(key, value))

## Feature

* [x] Full CRUD Support
* [x] $count
* [x] $filter
  * [x] Comparison Operators
  	* [x] eq
  	* [x] ne
  	* [x] lt
  	* [x] le
  	* [x] gt
  	* [x] ge
  * [ ] Logical Operators
  	* [x] and
  	* [ ] or
  	* [ ] not
  * [ ] Comparison Operators
    * [ ] has<commit_msg>edit.<commit_after>node-odata
==========
Create awesome REST APIs abide by [OData Protocol v4](http://www.odata.org/).  Its purpose is to easier to creating APIs, make you more focus on business logic.

  [![NPM Version](https://img.shields.io/npm/v/node-odata.svg?style=flat)](https://www.npmjs.org/package/node-odata)
  [![Build Status](https://img.shields.io/travis/TossShinHwa/node-odata.svg?style=flat)](https://travis-ci.org/TossShinHwa/node-odata)
  [![License](http://img.shields.io/npm/l/node-odata.svg?style=flat)](https://github.com/TossShinHwa/node-odata/blob/master/LICENSE)

```
var express = require('express'),
    odata = require('node-odata');
var app = express();

app.use(express.bodyParser());
app.use(express.query());

odata.set('app', app);
odata.set('db', 'mongodb://localhost/my-app');
odata.resources.register({ url: '/books', model: { title: String, price: Number } });

app.listen(3000);
```

Registers the following routes:

```
GET    /odata/books
GET    /odata/books/:id
POST   /odata/books
PUT    /odata/books/:id
DELETE /odata/books/:id
```

Use the following OData query:

```
Example
GET /books?$select=title, author
GET /books?$top=3&$skip=2
GET /books?$orderby=price desc
GET /books?$filter=price gt 10
GET ...
```

Try it:

* GET [/books?$select=title, author](http://books.zackyang.com/odata/books?$select=title, author)
* GET [/books?$top=3&$skip=2](http://books.zackyang.com/odata/books?$top=3&$skip=2)
* GET [/books?$orderby=price desc](http://books.zackyang.com/odata/books?$orderby=price desc)
* GET [/books?$filter=price gt 10](http://books.zackyang.com/odata/books?$filter=price gt 10)

## Current State

node-odata is currently at an alpha stage, it is stable but not 100% feature complete. node-odata is written by CoffeeScript then compiled to Javascript. It currently have to dependent on Express, MongoDB and mongoose yet. The current target is to remove the dependents then add more features.

## Install

```
npm install node-odata
```


## API Docs

* [resources.register(params)](https://github.com/TossShinHwa/node-odata/wiki/1.resources.register(params))
* [functions.register(params)](https://github.com/TossShinHwa/node-odata/wiki/2.functions.register(params))
* [set(key, value)](https://github.com/TossShinHwa/node-odata/wiki/3.set(key, value))

## Support Feature

* [x] Full CRUD Support
* [x] $count
* [x] $filter
  * [x] Comparison Operators
  	* [x] eq
  	* [x] ne
  	* [x] lt
  	* [x] le
  	* [x] gt
  	* [x] ge
  * [ ] Logical Operators
  	* [x] and
  	* [ ] or
  	* [ ] not
  * [ ] Comparison Operators
    * [ ] has
{'fraction_non_alphanumeric': 0.18246904024767802, 'fraction_numerical': 0.00890092879256966, 'mean_word_length': 4.296106557377049, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 16, 'lorem ipsum': 0, 'www.': 4, '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': '6085001', 'n_tokens_mistral': 1999, 'n_tokens_neox': 1899, 'n_words': 393}