Skip to content

Sanix-Darker/NodeJS-SQLite-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-js-sqlite

Simple NodeJS Rest API with CRUD routes. Using SQLite database

How to Install

$ npm install 
$ npm run dev

It will be running on port 4300


How to use

POST

  • 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:

[
	{...},{...}
]

PUT

  • 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

  • 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:

[
	{...},{...}
]

GET

  • 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:


  • 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)


Node version

The Node version used was 6.9.3

About

A simple NodeJS api working with sqlite Database (CRUD)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published