jiggak / shell-serve

POC Rust api server that dispatches route handling to external processes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

shell-serve \
   'GET:/{path..}?{query..} ./foo.sh ${path} ${query}' \
   'PUT:/{path..} cat'

shell-serve --listen 127.0.0.1 --port 8080 \
   'GET:/foo/{file}?foo={bar} handle_get_foo.sh ${file} ${foo}' \
   'GET:/poo/{file}#x-auth-token={token} handle_get_poo.sh ${file} ${token}' \
   'GET:/{path..}?{query..} handle_get.sh ${path} ${query}' \
   'PUT:/{path..} handle_write.sh ${path}' \
   'DELETE:/{path..} rm some_dir/${path}'
# test GET
curl --include http://localhost:8000/foo/baz.txt
# test PUT
curl --include http://localhost:8000/echo --upload-file hello.txt
port = 8080
listen = "127.0.0.1"

routes = [
   # "GET:/{path..}?{query..} ./foo.sh ${path} ${query}",
   { method = "GET", path = "/{path..}?{query..}", handler = "./foo.sh ${path} ${query}"},
   "PUT:/{path..} cat"
]

About

POC Rust api server that dispatches route handling to external processes


Languages

Language:Rust 100.0%