This repository provides a straightforward example of an order system that supports REST, gRPC, and GraphQL on the same server. The system allows you to create orders and retrieve a list of existing orders.
-
Clone this Repository:
git clone https://github.com/kameikay/order-system-example.git cd order-system-example
-
Start Docker Containers:
docker-compose up -d
-
Navigate to the 'cmd/ordersystem' Directory:
cd cmd/ordersystem
-
Run the Application:
go run main.go wire_gen.go
- Open
api/create_order.http
- Click on the
Send Request
button (or modify the request fields)
- Open
api/list_order.http
- Click on the
Send Request
button
- Use Evans CLI
evans -r repl
- Set the package:
$ package pb
- Set the service:
$ service OrderService
- Call the service:
$ call CreateOrder
- Set the package:
- Use Evans CLI
evans -r repl
- Set the package:
$ package pb
- Set the service:
$ service OrderService
- Call the service:
$ call ListOrders
- Set the package:
- Navigate to http://localhost:8080
- Run the following mutation query:
mutation createOrder { createOrder(input: { id: "cccc", Price: 123, Tax: 23 }) { id Price Tax FinalPrice } }
- Navigate to http://localhost:8080
- Run the following query:
query listOrders { listOrders { id Price Tax FinalPrice } }