All Projects → daviesgeek → restjs

daviesgeek / restjs

Licence: MIT License
An “ORM” style library for consuming REST APIs on the frontend

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to restjs

Python For Entrepreneurs Course Demos
Contains all the "handout" materials for Talk Python's Python for Entrepreneurs course. This includes notes and the final version of the website code.
Stars: ✭ 247 (+1800%)
Mutual labels:  orm
laravel-msaccess
Laravel ORM for Microsoft Access DB
Stars: ✭ 31 (+138.46%)
Mutual labels:  orm
feathers-objection
Feathers database adapter for Objection.js, an ORM based on KnexJS SQL query builder for Postgres, Redshift, MSSQL, MySQL, MariaDB, SQLite3, and Oracle. Forked from feathers-knex.
Stars: ✭ 89 (+584.62%)
Mutual labels:  orm
Database
💾 A database layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.
Stars: ✭ 251 (+1830.77%)
Mutual labels:  orm
awesome-go-orms
ORMs for Go, most starred on Github.
Stars: ✭ 206 (+1484.62%)
Mutual labels:  orm
pinipig
🚀 Performant webservice framework
Stars: ✭ 25 (+92.31%)
Mutual labels:  orm
Data
ATK Data - Data Access Framework for high-latency databases (Cloud SQL/NoSQL).
Stars: ✭ 243 (+1769.23%)
Mutual labels:  orm
gobatis
golang mybatis, 简单便捷
Stars: ✭ 46 (+253.85%)
Mutual labels:  orm
easy-es
Better Elastic Search search engine framework, the bottom layer adopts RestHighLevelClient, API design consistent with Mybatis-plus, zero additional learning cost, shielding language differences, developers only need to know MySQL syntax to complete Es-related operations, both Low code, easy to use, easy to expand and other features, support Es …
Stars: ✭ 218 (+1576.92%)
Mutual labels:  orm
heliosRX
⚡️ The fast way to build real-time apps with Vue and Firebase 🔥
Stars: ✭ 23 (+76.92%)
Mutual labels:  orm
Mikro Orm
TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases.
Stars: ✭ 3,874 (+29700%)
Mutual labels:  orm
Django
The Web framework for perfectionists with deadlines.
Stars: ✭ 61,277 (+471261.54%)
Mutual labels:  orm
gene
Grace, fastest, flexibility, simple PHP extension framework!优雅、极速、灵活、简单的PHP扩展框架!
Stars: ✭ 30 (+130.77%)
Mutual labels:  orm
Freesql
🦄 .NET orm, Mysql orm, Postgresql orm, SqlServer orm, Oracle orm, Sqlite orm, Firebird orm, 达梦 orm, 人大金仓 orm, 神通 orm, 翰高 orm, 南大通用 orm, Click house orm, MsAccess orm.
Stars: ✭ 3,077 (+23569.23%)
Mutual labels:  orm
sanic-mongodb-extension
MongoDB with μMongo support for Sanic framework
Stars: ✭ 25 (+92.31%)
Mutual labels:  orm
Odmantic
Async ODM (Object Document Mapper) for MongoDB based on python type hints
Stars: ✭ 240 (+1746.15%)
Mutual labels:  orm
java-bible
🍌 我的技术摘要
Stars: ✭ 2,950 (+22592.31%)
Mutual labels:  orm
gorm-hibernate5
GORM for Hibernate 5
Stars: ✭ 51 (+292.31%)
Mutual labels:  orm
MyDAL
The fastest and best ORM lite on C# for MySQL ! -- 友好, 轻量, 极致性能, 无任何第三方依赖, 持续演进~~
Stars: ✭ 32 (+146.15%)
Mutual labels:  orm
pyhikvision
hikvision-sdk for Python3 in action
Stars: ✭ 141 (+984.62%)
Mutual labels:  orm

RestJS

CircleCI

Sauce Labs Build Status

RestJS is somewhat based off Restangular. It is an “ORM” style library for consuming REST APIs on the frontend.

This is very much still a 1.0 version, so expect breaking changes and feature updates. It's also only really been tested in Chrome on OS X and PhantomJS, so it definitely needs more browser testing.

If you'd like, fill out this form to receive an invite to Slack.

Installing

Install using Bower:

bower install restjs

By default, the non-minified, non-polyfill version is set as the main property for the Bower package. The polyfill version includes the Babel polyfill in the source. Depending on what you're doing, you might need the polyfill to be included. Here's a quick example of how to use the polyfill version instead:

{
  "overrides": {
    "restjs": {
      "main": [
        "dist/rest.polyfill.js"
      ]
    }
  }
}

Other options include the minified version (dist/rest.min.js), the Node version (dist/rest.node.js: includes an export statement for ES6 modules), and the polyfill & minified version (dist/rest.polyfill.min.js)

Usage

The 10 second version

// Create a model factory
let Doctor = Rest.factory('doctors')

// Create a new element, passing in the object as the first argument
let doctor = Doctor.create({id: 11, first: "Matt", last: "Smith"})

// Save it!
doctor.post()

// Update something
doctor.name = "Matthew"
doctor.patch()

// Get a list of users
Doctor.getList().then(function(doctors) {
  // Do something with the array
})

Config

Configuration can be set using Rest.Config.set():

Rest.Config.set({baseUrl: 'https://restjs.js.org'})
baseUrl: String

The base URL for requests. I.e, if the baseUrl is set to http://google.com, all requests will be prefixed with http://google.com

defaultParams: Object

The default parameters for requests. Can be overriden by specific requests

fields: Object

Custom fields that RestJS uses to pick up on properties needed.

     id: String

     The property that RestJS should use as the id. This will be used for subsequent requests, such as DELETE, PUT or PATCH requests: <baseUrl>/<resource>/<id field>

headers: String[String[]]

An array of headers to send for the request. The headers must be an array, with each element containing an array, with the first element being the header name and the second the header value.

Rest.Config.set(
  {
    headers: [
      ['X-Requested-With': 'RestJ']
    ]
  }
)

See XMLHttpRequest.setRequestHeader()

responseType: String

The type of the response. See XMLHttpRequest.responseType

timeout: Integer

The timeout setting for XHR requests. See XMLHttpRequest.timeout

withCredentials: Boolean

whether to send CORS credentials with the request or not. See XMLHttpRequest.withCredentials

Development

Run npm install to install all the build tools. src/rest.js contains all the source code. Run npm run build to run Babel to compile for the browser.

Tests

RestJS uses Karma, Mocha, and Chai for running tests. Run local tests with npm run unit. Running npm run test will first lint the files, then run all the tests on Sauce Labs using karma-sauce-launcher.

Docs

All docs are written using the JSDoc syntax.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].