Chapter 5: Serving Static HTML in Gin
In this chapter, you will learn how to build a static web application that consumes Gin-based API responses. Along the way, you will learn how to serve web assets (JavaScript, Cascading Style Sheets (CSS), and images) and render HTML templates with Gin. Finally, you will cover how to build a self-contained web application with Go and resolve cross-origin resource sharing (CORS) policy errors with a Gin middleware.
In this chapter, we will focus on the following topics:
- Serving static files
- Rendering HTML templates
- Building a self-contained web application
- Building a Single-Page Application (SPA)
By the end of this chapter, you will be able to build a SPA with React to consume your RESTful API endpoints. ...
Get Building Distributed Applications in Gin now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.