Chapter 5 – Serving Static HTML in Gin
- Create a
header.tmpl
file with the following content:<head> <title>Recipes</title> <link rel="stylesheet" href="/assets/css/app.css"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet"> </head>
Then, reference the file in the
recipe.tmpl
with the following code block:{{template "/templates/header.tmpl.tmpl"}}
Follow the same approach to create a reusable template for the footer part.
- The full-source code of the
NewRecipe.js
component is available on the GitHub repository under the folder for Chapter 5, Serving static HTML in Gin. - Cross-compiling works by setting required environment variables that specify the target operating system and architecture. We use the variable
GOOS
for the target operating system, andGOARCH...