Sign inSign up

jeanbarriere/http

By jeanbarriere

Updated about 7 years ago

Http microservice

Image
0

305

jeanbarriere/http repository overview

Asyncy HTTP Gateway

API gateway server for executing Stories via HTTP.

http server as server
  when server listen method: 'get' path: '/' as req
    log info msg: req.body
    log info msg: req.headers
    log info msg: req.headers['Host']
    req write data: 'Hello World'
    req status code: 200
    req finish
curl https://foobar.storyscriptapp.com
>>> Hello World

Development

Setup virtual environment and install dependencies

virtualenv -p python3.6 venv
source venv/bin/activate
pip install -r requirements.txt

Run locally by calling

python -m app.main --logging=debug --debug
Register an endpoint
curl --data '{"endpoint": "http://localhost:9000/story/foo", "data":{"path":"/ping", "method": "post", "host": "a"}}' \
     -H "Content-Type: application/json" \
     localhost:8889/register

Now access that endpoint

curl -X POST -d 'foobar' -H "Host: a.storyscriptapp.com" http://localhost:8888/ping
Unregister an endpoint
curl --data '{"endpoint": "http://localhost:9000/story/foo", "data":{"path":"/ping", "method": "post", "host": "a"}}' \
     -H "Content-Type: application/json" \
     localhost:8889/unregister

Tag summary

Content type

Image

Digest

Size

336 MB

Last updated

about 7 years ago

docker pull jeanbarriere/http