-
Notifications
You must be signed in to change notification settings - Fork 6
how to write client code #4
Comments
Hi @lanwenchang Thanks for playing a little bit with this. To run the example in a development environment you will need to have the cloudstate proxy running and pointing to where your 'user function' is running as well. If you have Cloudstate CLI installed you can run this command: cloudstate run --only-proxy --user-function-port=8080 Otherwise you will need to manually run the proxy on the Docker: docker run --net=host --name=proxy --env HTTP_PORT: 9000 --env USER_FUNCTION_PORT:8080 cloudstateio/cloudstate-proxy-native-dev-mode:latest After you have your application and the proxy running, you can make requests to the proxy, one of which could be: # SET the body of request
export POST = '{"productId": "foo", "name": "A foo", "quantity": 10}'
# Add items to the shopping cart
curl -s -X POST http://localhost:9000/cart/1/items/add -H "Content-Type: application/json" -d "$POST"
# Repeat operation
curl -s -X POST http://localhost:9000/cart/1/items/add -H "Content-Type: application/json" -d "$POST"
# Get the shopping cart
curl http://localhost:9000/carts/1
# Get items from the shopping cart
curl http://localhost:9000/carts/1/items
For more information specific to Cloudstate I suggest you access the official project documentation: Or our channel on the Gitter: |
You could test via any grpc client, but via http is easier. |
ping @lanwenchang |
Hi, @sleipnir I had try to use proxy on the Docker, but it does not work. Because of the docker host mode can't work in Mac. see docker/for-mac#2716 So I trying to do with cloudstate-cli, unfortunately, there some wrong in my brew, so I had to fix it first. And then I will going to check if curl can work thanks for your advice :) |
Hi @lanwenchang |
Any progress @lanwenchang ? |
not yet there some wrong with the cloudstate-ci install
|
Sorry for that but this related of this mungotinae/cloudstate-cli#22 |
Hi! @lanwenchang Try again:
Sorry for the delay I was a little busy in the past few weeks. I believe everything is ok now but let me know if there are still any problems or questions. |
Closed due to inactivity |
I had run server success, and then how to write client code to test the ShopingChartEntity.
I try to send http request, but return 404.
The text was updated successfully, but these errors were encountered: