Go Expert challenge to create an application using clean arch.
1. First run the command below to start the dependencies:
$ make infra-up
Note: If you want to stop infra, run the command below:
$ make infra-down
2. After start dependencies, run the command below to execute migrations:
$ make migrate-create
Note: If you want to drop tables, run the command below:
$ make migrate-destroy
3. Finally, run the command below to start the application:
$ make run
To test the webserver, you can use the commands below:
$ curl -X POST --location "http://localhost:8000/order" --http1.1 \
-H "Host: localhost:8000" \
-H "Content-Type: application/json" \
-d "{
\"id\":\"web-server\",
\"price\": 100.5,
\"tax\": 0.5
}"
$ curl -X GET --location "http://localhost:8000/order" --http1.1 \
-H "Host: localhost:8000" \
-H "Content-Type: application/json"
To test the grpc server, you need install evans and run the commands below:
$ evans -r repl
pb.OrderService@127.0.0.1:50051> call CreateOrder
// Inputs
id (TYPE_STRING) => grpc-server
price (TYPE_FLOAT) => 430
tax (TYPE_FLOAT) => 2.0
call ListOrders
To test the graphql server, you need access the playground url http://localhost:8080/ and run the commands below:
mutation createOrder {
createOrder(
input: {id: "graphql-server", Price: 500.0, Tax: 2.0}
) {
id
Price
Tax
FinalPrice
}
}
query queryOrders {
orders {
id
Price
Tax
FinalPrice
}
}