- In the root directory, run
docker-compose up -d
- When you run the
main.go
file, the migrations will be executed automatically - Will be created a new table called
orders
with the following fields:id
- varchar(255)price
- doubletax
- doublefinal_price
- double
- Also, will be created sample data to test the application
- The sample data is the following:
- Go to
cmd/ordersystem
directory - Run
go run main.go wire_gen.go
- Open
api.http
file - Click on
POST .../order
and then click onSend Request
- Alternate on
id
,price
andtax
fields to create a new order
- Open
api.http
file - Click on
GET .../order
and then click onSend Request
- On the terminal run
evans -r repl
to access the GRPC client
- Run
call CreateOrder
to create a new order - Enter the
id
,price
andtax
fields to create a new order
- Run
call ListOrders
to get all orders
- Open
http://localhost:8080/
on the browser
- Run the following mutation to create a new order
mutation createOrder {
createOrder(input: {id: "abc123", Price: 10.0, Tax: 2.0}) {
id
Price
Tax
FinalPrice
}
}
- Run the following query to get all orders
query listOrders {
listOrders {
id
Price
FinalPrice
}
}