Skip to content

joon610/mockup-server

Repository files navigation

Mock Server

mock-manual

Translate

한국어 : https://joon610.github.io/sideproject/MockUp-Server
日本語 : https://qiita.com/joon610/items/f5aae93815b536a3f56b

Usage

Start

graph

  1. created directory.
  2. make index.json file in each directory
  3. If you want to configure more, and then add error.json, setting.json
  4. Mockup Server start!

index.json

// response json
[
  {
        "id": "1",      //dynamic api key   ex) localhost/bla/:id
        "name": "Sara",
        "age": "13"
    },
    {
        "id": "2",
        "name": "teddy",
        "age": "14"
    }   
]

setting.json

// setting header, cookies, api description etc 
{
    "header": {
        "Content-Type": "application/json; charset=utf-8",
        "Content-Length": "123",
        "ETag": "12345"
    },
    "cookies": [
        {  //cookie1
            "cookiekey": "cookieName",
            "options": {
                "maxAge": 30000
            }
        },
        { //cookie2
            "hello": "hi",
            "options": {
                "maxAge": 10000
            }
        }
    ],
    "dynamicRoute":"hello",      //  ex) localhost/bla/:hello
    "description": "this API is holy shit" // api description

}

Set Cookies

headerSetting

API Description tooltip

tooltip

CRUD (Create, Read, Update ,Delete)

// index.json
[
  {
        "id": "1", 
        "name": "Sara",
        "age": "13"
    },
    {
        "id": "2",
        "name": "teddy",
        "age": "14"
    }   
]

Post, Get

//response data
[
    {
      "id": "1", 
      "name": "Sara",
      "age": "13"
    },
    {
      "id": "2",
      "name": "teddy",
      "age": "14"
    }   
]
//response data
[
    {
      "id": "1",   
      "name": "Sara",
      "age": "13"
    }
]

Put

//request data
{
  "id": "3", 
  "name": "Sara",
  "age": "13"
}
//response data
[
    {
      "id": "3",   
      "name": "Sara",
      "age": "13"
    },
    {
      "id": "2",
      "name": "teddy",
      "age": "14"
    }   
]

Delete

//response data
[
    {
        "id": "2",
        "name": "teddy",
        "age": "14"
    }   
]

DownLoad

TodoList

  • request parameter check
  • delay response
  • request parameta log

Bug

  • use setting.json and then don't work CRUD.

License

MIT License

Project setupø

yarn install

Compiles and hot-reloads for development

yarn dev

Compiles and minifies for production(electront)

build:electron

About

this is mock server (Vue + TypeScript + Electron)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •