@jimengio/serve-json
v0.0.6
Published
Serve JSON ----
Downloads
34
Readme
Serve JSON
Usage
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