0.5.17 • Published 2 years ago

@kernel-js/api v0.5.17

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@kernel-js/api

Build Status Coverage Status

Package to easily develop REST API following JSON API specification.

Why

First of all I created this to support development of Kernel Framework. Just like the rest of the packages that make up the framework, I make the most of other existing libraries that are well tested on a day-to-day basis. The idea is not to reinvent the wheel, just join the ideas in a lightweight framework (the focus is on the client side), simple to use and make the code on the front more beautiful and organized.

Install

npm install @kernel-js/api

Class Directory

Common Class

Common Triggers Methods

Common Request Methods

Common Fetching Methods

Building Classes

Base Entity Class

É necessario criar uma classe que herdará e sobrescreverá os metodos dessa classa dentro da sua aplicação Essa mesma classe vai ser herdada pelas entidades da aplicação.

export default class Entity extends EntityManager {

  async request (config) {
    return Axios.request(config); // Você retornará a instancia do axios na sua aplicação
  }

  baseUrl() {
    return 'http://127.0.0.1:8000/api'
  }

}

Aplication Entity Class

Você sobreescreverá os metodos de entity na sua aplication-entity (user) informando os dados e relacionamentos da mesma.

export default class Post extends Entity{

    resourceName() {
      return 'users';
    }
    
    fields() {
      return ['name', 'email', 'subnick'];
    }
    
    relationshipNames() {
      return ['company', 'owner'];
    }

}

Authors

This library was developed by

  • Gustavo Siqueira
  • Bruno Santos
  • Carlos Henrique Escouto

Contribute

Please do! Check out our Contributing guidelines.

License

MIT © 2018-2018 Kernel JS

0.5.17

2 years ago

0.4.17

3 years ago

0.4.16

4 years ago

0.3.16

4 years ago

0.3.15

4 years ago

0.3.14

4 years ago

0.2.14

5 years ago

0.2.13

5 years ago

0.2.12

5 years ago

0.2.11

5 years ago

0.2.10

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.0

5 years ago