@kernel-js/api
@kernel-js/api
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
getEntity
getContent
getUrl
getUrlConfig
Common Request Methods
all
find
search*
save
delete
attach
detach
createPivot
deletePivot
Common Fetching Methods
with
select
orderByAsc
orderByDesc
where
limit
Building Classes
Base Entity Class
É necessário criar uma classe que herdará e sobrescreverá os métodos dessa classe dentro da sua aplicação Essa mesma classe vai ser herdada pelas entidades da aplicação.
Aplication Entity Class
Você sobrescreverá os métodos de Entity na sua aplication-entity (user) informando os dados e relacionamentos da mesma.
All
/api/posts
GET https://api.kernel.com/v1/api/posts
This endpoint allows you to get posts.
Find
/api/posts/1
GET https://api.kernel.com/v1/api/posts/1
Paginate
/api/posts?page[size]=5&page[number]=1
GET https://api.kernel.com/api/posts?page[size]=5&page[number]=1
Path Parameters
page[size]
string
Quantos registros por pagina
Query Parameters
page[number]
string
Pagina atual
Save
Create
/api/posts
POST https://api.kernel.com/api/posts
Update
/api/posts/1
PUT https://api.kernel.com/api/posts/1
Delete
/api/posts
DELETE https://api.kernel.com/api/posts/1
With
/api/posts/1
GET https://api.kernel.com/api/posts/1?include=tags,author
Path Parameters
include
string
Relacionamento entre entidades
Authors
This library was developed by
Carlos Henrique Escouto
Gustavo Siqueira
Bruno Santos
Contribute
Please do! Check out our Contributing guidelines.
License
MIT © 2018-2018 Kernel JS
Last updated
Was this helpful?