blogspiral/app:2.xappsrcServices- GRPC service implementation
usersspiral/app:2.xappsrcServices- GRPC service implementation
sharedspiral/grpc-skeletonproto- Proto files for GRPC servicesservices.php- list of proto files to compilesrcServices- compiled GRPC services
docker- docker containers
- Make sure you have protoc installed and available in your OS.
- Download
protoc-gen-php-grpcfor compiling proto files../rr get-protoc-binary. - Compile proto files.
./rr compile-proto-files. - Build docker containers
docker compoe build.
You just need to run docker-compose up to start the services.
GET: http://localhost:8081/users- list of users
curl --location --request GET 'http://localhost:8081/users'
GET: http://localhost:8081/user/<id>- Show user with given ID
curl --location --request GET 'http://localhost:8081/user/15'
POST: http://localhost:8081/user- Register a new user
curl --location --request POST 'http://localhost:8081/user' \
--form 'username="guest"' \
--form 'password="secret"' \
--form 'email="example@site.com"' \
--form 'is_admin="0"'
POST: http://localhost:8081/user/auth- Authenticate user
curl --location --request POST 'http://localhost:8081/user/auth' \
--form 'username="mrutherford"' \
--form 'password="secret"'
DELETE: http://localhost:8081/user/<id>- Delete user with given ID
curl --location --request DELETE 'http://localhost:8081/user/50'
GET: http://localhost:8081/blog- list of posts
curl --location --request GET 'http://localhost:8081/blog'
GET: http://localhost:8081/blog/post/<id>- Show post with given ID
curl --location --request GET 'http://localhost:8081/blog/post/15'
POST: http://localhost:8081/blog/post/<id>- Update post with given ID
curl --location --request POST 'http://localhost:8081/blog/post/<id>' \
--form 'title="Hello world"' \
--form 'text="Blog post content"'
DELETE: http://localhost:8081/blog/post/<id>- Delete post with given ID
curl --location --request DELETE 'http://localhost:8081/blog/post/50'
POST: http://localhost:8081/blog/post- Create a new post
curl --location --request POST 'http://localhost:8081/blog/post' \
--form 'title="Hello world"' \
--form 'text="Blog post content"'