Skip to content

AmirRezaM75/json-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Getting started

Clone the repository:

git clone [email protected]:AmirRezaM75/json-server.git

Navigate to the cloned directory:

cd json-server

Create api.json file with following structure:

{
  "port": 3000,
  "endpoints": [
    {
      "method": "GET",
      "status": 200,
      "path": "/users",
      "jsonPath": "./users.json"
    },
    {
      "method": "POST",
      "status": 201,
      "path": "/users/:userId/comments",
      "jsonPath": "./comment.json"
    }
  ]
}
  • port: port number that server will listen on.
  • method: specifies HTTP request method. Possible values are GET, POST, PUT, PATCH or DELETE.
  • jsonPath: path to .json file that represents contents of response.

Start JSON Server:

go run main.go

About

Simple fake JSON server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages