Introducing IronwingJS

Andrei Cacio

Web developer @ Evozon Systems

http://andrei-cacio.github.io/ironwing

How it all started

  • we wanted something easy to use
  • framework agnostic
  • it should do only data manipulation
  • we didn't know how the project will evolve

How we wanted it to work?

GET  ->       /users

GET  ->       /users/:id

POST ->      /users

PUT ->        /users/:id

DELETE -> /users/:id

JSON API

Server

Client

?

Let's generalize the problem

  • we want some sort of model
  • we want to manipulate data
  • we want a representation of the data
  • we want something extensible
  • we want.... a genreal solution

Introducing IronwingJS

GET  ->       /users

GET  ->       /users/:id

POST ->      /users

PUT ->        /users/:id

DELETE -> /users/:id

JSON API

Server

Client

ironwingjs

.get()

.create()

.update()

.delete()

Cool features

  • adapters
  • proxy objects
  • storage

Adapters

/**
 * all API calls will being with /api
 */
ironwing.useAdapter('JSON', ['api']);

/**
 * GET Users collection
 * GET -> /api/users
 */
ironwing('users').then((users) => {
    console.log(users.length);
});
  • extensible
  • abstract layer over transport

Proxy objects

ironwing('users', 1).then((user) => {
    console.log('My name is ', user.attr.firstName);
});
// My name is John
// /api/users/1
{
    "first_name": "John",
    "last_name": "Doe"
}

JSON API

ironwing model representation

  • preprocess data
  • filter modifications

Storage

ironwing('users', 1).then((user) => {
    user.attr.firstName = 'Oliver';
    user.update();
});

edit-user.js

let user = ironwing.storage.find('users', 1);

export default function render() {
    document
        .getElementById('user-firstname')
        .text(user.attr.firstName);
}

user-firstname-component.js

  • stores all models
  • everything done on the model is mirrored on the storage
  • highly extensible

To sum up

  • it's open-source!
  • it's easy to use
  • there is still work to be done
  • anyone can contribute  

Thank you!

 

 

Questions?

Introducing IronwingJS

By Andrei Cacio

Introducing IronwingJS

  • 2,208