npx @anyapi/anyapi
or
npm i @anyapi/anyapi -g
anyapi
This will start the server on the default port of 2000
. Using any HTTP client you can now GET
, POST
, PUT
, DELETE
with a collection type that is completely variable and up to you.
For example hamburgers
:
fetch('http://localhost:2000/hamburgers', {
method: 'POST',
body: JSON.stringify({ name: 'Cheese Burger', ingredients: ['beef', 'tomato', 'lettuce', 'cheese'] }),
headers: new Headers({'Content-Type': 'application/json'})
})
Then GET on http://localhost:2000/hamburgers
to see your new collection
GETALL
on:collection
GET
on:collection
with:id
CREATE
on:collection
with:data
UPDATE
on:collection
with:id
and:data
DESTROY
on:collection
with:id