Simple NodeJS Rest API with CRUD routes. Using SQLite database
$ npm install
$ npm run dev
It will be running on port 4300
- Add new found:
http://localhost:4300/api/found
Sending a JSON body:
{
"name": "ExampleFoundName",
"description": "Example found description",
"price": 2.00,
"currency": "EUR"
}
or an array of founds:
[
{...},{...}
]
- Update a found:
http://localhost:4300/api/found
Sending a JSON body: ID is the only MANDATORY
{
"id": "1",
"name": "ExampleFoundName",
"description": "Example found description",
"price": 2.00,
"currency": "EUR"
}
or an array of founds:
[
{...},{...}
]
- Delete a found:
http://localhost:4300/api/found
Sending a JSON body: ID is the only MANDATORY
{
"id": "1",
"name": "ExampleFoundName",
"description": "Example found description",
"price": 2.00,
"currency": "EUR"
}
or an array of founds:
[
{...},{...}
]
- Load founds by ID:
http://localhost:4300/api/found/id/$id
example: http://localhost:4300/api/found/id/15
- Load all founds:
http://localhost:4300/api/found/
- Load founds by any attribute and value:
http://localhost:4300/api/found/$attribute/$name
example:
- http://localhost:4300/api/found/price/24
- http://localhost:4300/api/found/name/Suntone $attribute = ['name', 'price', 'currency', 'description'] (this is not checked values, wrong parameters will return a DB error.)
- Load all founds sorting by attribute
http://localhost:4300/api/found/sort/$attribute
example:
$attribute = ['name', 'price', 'currency', 'description'] (this is not checked values, wrong parameters will return a DB error)
- Load founds sorting ASC or DESC by any attribute:
http://localhost:4300/api/found/sort/$direction/$attribute
example:
$attribute = ['name', 'price', 'currency', 'description']* $direction [ASC or DESC]C]* (the direction is checked and when wrong will return a 401 business error)
The Node version used was 6.9.3