Now that front-end development has never been so fast, I wondered : Why is my API not able to follow the pace of my AngularJS client?!
Tired of that situation, I took advantage of a private hackathon organized by some folks at Lateal Throughts to start the project and Rony (@obigroup) and I developped a little API able to accept any request you can make and answer RESTfully like you hope it would !
A Full Featured CRUD API
One is able to use a full feature (GET, POST, PUT, DELETE, PATCH) REST (and HATEOAS) API.
For instance
curl -XPOST -d '{ "username": "MaximeGaudin" }' http://localhost:8091/users
{
"username": "MaximeGaudin",
"_links": [
{
"href": "http://apimorph.herokuapp.com/users/533328c09be9b200070211d5",
"rel": "self"
}
]
}
creates a new endpoint /users :
curl http://localhost:8091/users
{
"content": [
{
"username": "MaximeGaudin",
"_links": [
{
"href": "http://apimorph.herokuapp.com/users/533328c09be9b200070211d5",
"rel": "self"
}
]
}
],
"meta": {
"size": 20,
"total": 1,
"page": 1
},
"links_": []
}
To allow wild debugging, even inexistent endpoints returns something :
curl http://localhost:8091/inexistent
{
"content": [ ],
"meta": {
"size": 20,
"total": 0,
"page": 1
},
"links_": []
}
Pagination
As you already noticed, every results are paginated. One can specify page and page size with the following GET parameters :
-
page: Sets the page number (default: 1) -
size: Sets the page size (default: 20)
For instance :
curl http://localhost:8091/users?page=1&size=1
{
"content": [
{
"username": "MaximeGaudin",
"_links": [
{
"href": "http://apimorph.herokuapp.com/users/533328c09be9b200070211d5",
"rel": "self"
}
]
}
],
"meta": {
"size": 20,
"total": 1,
"page": 1
},
"links_": [
{
"href": "http://apimorph.herokuapp.com/users?page=2&size=1",
"rel": "next"
}
]
}
Sorting
TODO
FindBy
TODO
Resource linking and Denormalization
TODO
Installation guide
TODO
How to contribute ?
TODO