Skip to content

Latest commit

 

History

History
133 lines (105 loc) · 3.05 KB

README.md

File metadata and controls

133 lines (105 loc) · 3.05 KB

node-odata

Create awesome REST APIs abide by OData Protocol v4. Its purpose is to easier to creating APIs, make you more focus on business logic.

NPM Version npm Build Status Coverage Status License

var odata = require('node-odata');

var server = odata('mongodb://localhost/my-app');

server.resource('books', { 
  title: String, 
  price: Number 
});

server.listen(3000);

Registers the following routes:

GET    /books
GET    /books(:id)
POST   /books
PUT    /books(:id)
DELETE /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 ...

Current State

node-odata is currently at an alpha stage, it is stable but not 100% feature complete. node-odata is written by ECMAScript 6 then compiled to ECMAScript 5 by babel. It currently have to dependent on MongoDB yet. The current target is to add more features and make other database adapter (eg. MySQL, PostgreSQL).

Installation

npm install node-odata

DOCUMENTATION

Support Feature

  • Full CRUD Support
  • $count
  • $filter
    • Comparison Operators
      • eq
      • ne
      • lt
      • le
      • gt
      • ge
    • Logical Operators
      • and
      • or
      • not
    • Comparison Operators
      • has
    • String Functions
      • indexof
      • contains
      • endswith
      • startswith
      • length
      • substring
      • tolower
      • toupper
      • trim
      • concat
    • Arithmetic Operators
      • add
      • sub
      • mul
      • div
      • mod
    • Date Functions
      • year
      • month
      • day
      • hour
      • minute
      • second
      • fractionalseconds
      • date
      • time
      • totaloffsetminutes
      • now
      • mindatetime
      • maxdatetime
    • Math Functions
      • round
      • floor
      • ceiling
  • $select
  • $top
  • $skip
  • $orderby
  • $expand
  • $metadata generation (Nonstandard)

CONTRIBUTING

We always welcome contributions to help make node-odata better. Please feel free to contribute to this project.

LICENSE

node-odata is licensed under the MIT license. See LICENSE for more information.