0.0.6 • Published 4 years ago

@jimengio/serve-json v0.0.6

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

Serve JSON

Usage

npm.io

yarn global add @jimengio/serve-json
serve-json config.edn

Example of config.edn:

{
  :port 7800
  :fallback-host nil
  :routes [
    {
      :path "home"
      :get {:type :file, :file "home.json"}
    }
    {
      :path "plants/:plant-id"
      :get {:type :file, :file "plant-default.json"}
      :post {:type :file, :file "ok.json"}
      :next [
        {
          :path "overview"
          :get {:type :file, :file "overview.json"}
        }
        {
          :path "materials/:material-id"
          :get {:type :file, :file "materials.json"}
          :next [
            {
              :path "events"
              :get {:type :file, :file "events.json"}
              :delete {:code 202, :type :file, :file "ok.json"}
            }
          ]
        }
      ]
    }
  ]
}

Besides EDN, JSON, CSON, YAML and Cirru EDN are also supported(Comparison of data formats supported #5):

serve-json config.json

# also
serve-json config.cirru

# also
serve-json config.cson

# also
serve-json config.yaml

:fallback-host

When :fallback-host is specified, it will be used as a default proxy target when no config path is matched.

License

MIT

0.0.6

4 years ago

0.0.6-a3

4 years ago

0.0.6-a2

4 years ago

0.0.6-a1

4 years ago

0.0.5

4 years ago

0.0.5-a2

4 years ago

0.0.5-a1

4 years ago

0.0.4

4 years ago

0.0.4-a2

4 years ago

0.0.3

4 years ago

0.0.3-a4

4 years ago

0.0.2

4 years ago

0.0.2-a3

4 years ago

0.0.2-a2

4 years ago

0.0.2-a1

4 years ago

0.0.1

4 years ago

0.0.1-a10

4 years ago

0.0.1-a11

4 years ago

0.0.1-a9

4 years ago

0.0.1-a8

4 years ago

0.0.1-a7

4 years ago

0.0.1-a6

4 years ago

0.0.1-a5

4 years ago

0.0.1-a4

4 years ago

0.0.1-a3

4 years ago

0.0.1-a2

4 years ago

0.0.1-a1

4 years ago