All Projects → andrei-cacio → Ironwing

andrei-cacio / Ironwing

Licence: mit
universal, framework agnostic, transport layer

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Ironwing

Axios Tutorial
axios实例应用及源码剖析 - xhr篇 (走心教程)
Stars: ✭ 219 (+1188.24%)
Mutual labels:  ajax, xhr
Rext
🎈A lightweight (< 5kb gzipped) and Promise-supported HTTP request library, for all browsers.
Stars: ✭ 14 (-17.65%)
Mutual labels:  ajax, xhr
Xhr.js
🌎 xhr.js is a library(< 2Kb) to make AJAX/HTTP requests with XMLHttpRequest.
Stars: ✭ 12 (-29.41%)
Mutual labels:  ajax, xhr
Atomic
A tiny, Promise-based vanilla JS Ajax/HTTP plugin with great browser support.
Stars: ✭ 526 (+2994.12%)
Mutual labels:  ajax, xhr
angular-progress-http
[DEPRECATED] Use @angular/common/http instead
Stars: ✭ 43 (+152.94%)
Mutual labels:  xhr, ajax
upload-file-to-backblaze-b2-from-browser-example
Demonstrates calling the b2_upload_file Backblaze B2 Cloud Storage API from a web browser using AJAX.
Stars: ✭ 28 (+64.71%)
Mutual labels:  xhr, ajax
Resource Loader
A middleware-style generic resource loader built with web games in mind.
Stars: ✭ 364 (+2041.18%)
Mutual labels:  ajax, xhr
http
Tiny, embeddable HTTP client with simple API for the browser
Stars: ✭ 21 (+23.53%)
Mutual labels:  xhr, ajax
electron-request
Zero-dependency, Lightweight HTTP request client for Electron or Node.js
Stars: ✭ 45 (+164.71%)
Mutual labels:  xhr, ajax
Thwack
A tiny modern data fetching solution
Stars: ✭ 268 (+1476.47%)
Mutual labels:  ajax, xhr
Elfinder
📁 Open-source file manager for web, written in JavaScript using jQuery and jQuery UI
Stars: ✭ 4,189 (+24541.18%)
Mutual labels:  ajax
Kkjsbridge
一站式解决 WKWebView 支持离线包,Ajax/Fetch 请求,表单请求和 Cookie 同步的问题 (基于 Ajax Hook,Fetch Hook 和 Cookie Hook)
Stars: ✭ 462 (+2617.65%)
Mutual labels:  ajax
Ssm Bookappointment
优雅整合SSM框架:SpringMVC + Spring + MyBatis(用户登陆式图书预约系统)
Stars: ✭ 666 (+3817.65%)
Mutual labels:  ajax
Blog
关注基础知识,打造优质前端博客,公众号[前端工匠]的作者
Stars: ✭ 6,873 (+40329.41%)
Mutual labels:  ajax
Web
适合java新手入门练习的java web个人网站项目,目前主要维护web-mysql和web-psql两个分支。前台包括博客、代码库、文件下载、留言、登录注册、站内搜索、分类目录等功能,后台包括上传文件、博客、代码,编辑、删除文章,修改个人资料等功能,目前暂停开发新功能。网址:https://demo.hemingsheng.cn ,觉得不错的欢迎 star。 手机版网址:
Stars: ✭ 414 (+2335.29%)
Mutual labels:  ajax
Cj Upload
Higher order React components for file uploading (with progress) react file upload
Stars: ✭ 589 (+3364.71%)
Mutual labels:  xhr
Tabulator
Interactive Tables and Data Grids for JavaScript
Stars: ✭ 4,329 (+25364.71%)
Mutual labels:  ajax
Sms Ssm
🏫 🎓 一个基于 SSM 的简单学生管理系统 : 项目概述全面,代码注释详细,逻辑结构清晰,并提供待优化方案,非常具有参考与学习价值哟 !
Stars: ✭ 351 (+1964.71%)
Mutual labels:  ajax
Infinite Ajax Scroll
Turn your existing pagination into infinite scrolling pages with ease
Stars: ✭ 804 (+4629.41%)
Mutual labels:  ajax
Opensource Socialnetwork
Open Source Social Network (OSSN) is a social networking software written in PHP. It allows you to make a social networking website and helps your members build social relationships, with people who share similar professional or personal interests. It is available in 16 international languages.
Stars: ✭ 710 (+4076.47%)
Mutual labels:  ajax

npm version Bower version Build Status

About

In a few words, ironwingjs is a lightweight, isomorphic, framework-agnostic JavaScript library. ironginwjs is ment to be super easy to use and easy to integrate on any app. Out of the box it offers CRUD manipulation over a REST API interface.

Installation

$ npm install ironwing

How it works

Ironwing was ment to be simple. So let's say we have the /api/users endpoint and we want to manipulate the data that's coming from that API.

// Tell ironwing to interact with the /api base path for all operations
ironwing.base = '/api';

// Fetch a collection and make a GET hit on /api/users
ironwing('users').then((users) => {
  // do something with users collection
});

// Fetch a single resource
ironwing('users', 100).then((user) => {
  // do something with the fetched user resource
});

// Update a resource
ironwing('users', 100).then((user) => {
  // access the resource attributes via the .attr object
  user.attr.name = 'Carl';
  user.update();
});

// Delete a resource
ironwing('users', 100).then((user) => {
  user.delete();
});

REST

Here is a map of the endpoints ironwing will hit on every operation

Action Method URL Returns
ironwing('users', 1) GET /users/:id Model
ironwing('users') GET /users Collection
user.update() PUT /users/:id Model
ironwing.create() POST /users Model
user.delete() DELETE /users/:id NULL

Core concepts


Adapters

An adapter is an object which follows a predefined interface so that it can be integrated with ironwing. Out of the box, ironwingjs comes with a JSON adapter which is an intermediate object that communicates with the XMLHttpRequest API. The developer doesn't interact directly with the adapter. The adapter is used “under the hood” by ironwing. The main purpose of adapters is to easily modify how ironwing interacts with the server. Anyone can write their own adapter and use it with ironwingjs. By default, ironwing loads the JSON adapter. You only have to specify the API's path so ironwing can communicate with your service properly. Here's a simple example:

import ironwing from './ironwing';

ironwing.base = '/api';

Storage

By default, ironwing has a local (heap) storage. After ironwing fetches a new model, by default it stores it locally for later use. So for example if we were to fetch data from an endpoint called /users/100:

ironwing('users', 100).then((user) => { 
    console.log(user.attr.name); 
});

We can later on retrieve that model from memory without any extra trips to the server, by simply calling

var userModel =  ironwing.storage.find('users', 100);

Or, if we fetched a collection

ironwing('users',).then((users) => { 
  console.log(users.length); 
});

we can later on get one or all users type model

var usersCollection =  ironwing.storage.findAll('users');

For the moment, only the default storage can be used. In future releases we hope to implement a way to switch between storage implementations like an adapter for local storage so you can save the state of your models after refresh.

Proxy objects

The constructor method ironwing() is basically a factory method which returns Model instances. Each model exposes CRUD methods for manipulating your data. However, ironwing never modifies the raw JSON data directly. It exposes a proxy object as an intermediate. Each model object has a .attr object which contains a camel cased transformation of the JSON response. Everything you edit on the attr proxy object, it will be later synced with the original raw response and sent to the back-end. This technique offers control over what gets edited and what doesn't. In future releases, with the help of the proxy object, some cool features can be added like validators on attributes.

A quick create and update example:

import ironwing from './ironwing';

var userData = {
    first_name: 'Jon',
    last_name: 'Doe';
};

ironwing.base = '/api';
ironwing.create('users', userData).then((userModel) => {
    /**
    * a POST request is sent to the server
    * /api/users
    */
    userModel.attr.firstName = 'Jon';
    userModel.attr.lastName = 'Doe';

    userModel.update().then(() => {
        /**
        * a PUT request is sent to the server
        * /api/users/:id
        */
    });
});

ironwingjs in Today Software Magazine

Introducing Ironwingjs

License

MIT

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].