Skip to content

First time learning experience using the Goa framework for designing and developing a simple calculator microservice in Go.

Notifications You must be signed in to change notification settings

cpatsonakis/goa-calc-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goa-calc-example

First time learning experience using the Goa framework for designing and developing a simple calculator microservice in Go.

To generate:

goa gen github.com/cpatsonakis/goa-calc-example/design/goa-calc -o goa-calc

To generate the example:

goa example github.com/cpatsonakis/goa-calc-example/design/goa-calc -o goa-calc

The following code was added to the multiplication service implementation:

// Multiply two integers a and b and get the result in the response's body.
func (s *calcsrvc) Multiply(ctx context.Context, p *calc.MultiplicationPayload) (res string, err error) {
	s.logger.Print("calc.multiply")
	a := big.NewInt(p.A)
	b := big.NewInt(p.B)
	return a.Mul(a, b).String(), nil
}

Build the executable of the service:

go build ./goa-calc/cmd/calc

Run the service:

./calc -debug -http-port 8080

Clean-up:

rm -rf goa-calc/gen

About

First time learning experience using the Goa framework for designing and developing a simple calculator microservice in Go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages