0.1.4 • Published 6 years ago

pk-json-server v0.1.4

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

pk-json-server

Create a RESTful API in NodeJS from a json file
Supported verbs: GET, POST, PUT and DELETE
Enabled CORS

Install

npm install -g pk-json-server

Database json

create file with extension .json
example: db.json

{
	"/api/v1/frameworks": [
        {
            "id": 1,
            "name": "Angular"
        }, 
        {
            "id": 2,
            "name": "React"
        }, 
        {
            "id": 3,
            "name": "VueJS"
        }
    ]
}

Run

In the terminal execute the following command, by default it will use port 3000:

pk-json-server db.json 

Change execution port:

pk-json-server db.json --port=9090

CRUD

Example of generated URIs:

GET: http://localhost:3000/api/v1/frameworks
GET: http://localhost:3000/api/v1/frameworks/1
POST: http://localhost:3000/api/v1/frameworks
PUT: http://localhost:3000/api/v1/frameworks/1
DELETE: http://localhost:3000/api/v1/frameworks/1

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago