Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Go: Design Patterns for Real-World Projects

You're reading from   Go: Design Patterns for Real-World Projects Build production-ready solutions in Go using cutting-edge technology and techniques

Arrow left icon
Product type Course
Published in Jun 2017
Publisher Packt
ISBN-13 9781788390552
Length 1091 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (3):
Arrow left icon
Mario Castro Contreras Mario Castro Contreras
Author Profile Icon Mario Castro Contreras
Mario Castro Contreras
Mat Ryer Mat Ryer
Author Profile Icon Mat Ryer
Mat Ryer
Vladimir Vivien Vladimir Vivien
Author Profile Icon Vladimir Vivien
Vladimir Vivien
Arrow right icon
View More author details
Toc

Table of Contents (38) Chapters Close

Go: Design Patterns for Real-World Projects
Credits
Preface
Bibliography
1. A First Step in Go FREE CHAPTER 2. Go Language Essentials 3. Go Control Flow 4. Data Types 5. Functions in Go 6. Go Packages and Programs 7. Composite Types 8. Methods, Interfaces, and Objects 9. Concurrency 10. Data IO in Go 11. Writing Networked Services 12. Code Testing 13. Ready... Steady... Go! 14. Creational Patterns - Singleton, Builder, Factory, Prototype, and Abstract Factory Design Patterns 15. Structural Patterns - Composite, Adapter, and Bridge Design Patterns 16. Structural Patterns - Proxy, Facade, Decorator, and Flyweight Design Patterns 17. Behavioral Patterns - Strategy, Chain of Responsibility, and Command Design Patterns 18. Behavioral Patterns - Template, Memento, and Interpreter Design Patterns 19. Behavioral Patterns - Visitor, State, Mediator, and Observer Design Patterns 20. Introduction to Gos Concurrency 21. Concurrency Patterns - Barrier, Future, and Pipeline Design Patterns 22. Concurrency Patterns - Workers Pool and Publish/Subscriber Design Patterns 23. Chat Application with Web Sockets 24. Adding User Accounts 25. Three Ways to Implement Profile Pictures 26. Command-Line Tools to Find Domain Names 27. Building Distributed Systems and Working with Flexible Data 28. Exposing Data and Functionality through a RESTful Data Web Service API 29. Random Recommendations Web Service 30. Filesystem Backup 31. Building a Q&A Application for Google App Engine 32. Micro-services in Go with the Go kit Framework 33. Deploying Go Applications Using Docker 1. Good Practices for a Stable Go Environment

Running apps with multiple modules


For applications such as ours that have multiple modules, we need to list out all the YAML files for the goapp command.

To serve our new application, in a terminal, execute this:

goapp serve dispatch.yaml default/app.yaml api/app.yaml
     web/app.yaml

Starting with the dispatch file, we are listing all the associated configuration files. If you miss any, you will see an error when you try to serve your application. Here, you will notice that the output now lists that each module is being deployed on a different port:

We can access modules directly by visiting each port, but luckily we have our dispatcher running on port :8080, which will do that for us based on the rules we specified in our dispatch.yaml configuration file.

Testing locally

Now that we have built our application, head over to localhost:8080 to see it in action. Use the features of the application by performing the following steps:

  1. Log in using your real e-mail address (that way, you'll see...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime