How to render html page to browser?

I have written a piece of code to render html to browser using renderer package:

package main

import (

// “



var rnd *renderer.Render

func init() {

opts := renderer.Options{

ParseGlobPattern: “./src/templates/*.html”,


rnd = renderer.New(opts)


func main() {

mux := http.NewServeMux()


mux.HandleFunc("/login", loginHandler)


http.ListenAndServe(port, mux)


func loginHandler(w http.ResponseWriter, r *http.Request) {

rnd.HTML(w, http.StatusOK, “login”, nil)

// login.html is placed in src/templates folder.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.