all repos — nds-converter @ 5b5911dcfac31e65d6c727444b88c5f700ca4ee3

A lightweight save converter for NDS and DeSmuME.

frontend.go (view raw)

 1package main
 2
 3import (
 4	"bytes"
 5	"embed"
 6	"net/http"
 7	"text/template"
 8)
 9
10const templatesDirectory = "templates/"
11
12var (
13	//go:embed templates/index.html
14	templates     embed.FS
15	indexTemplate = template.Must(template.ParseFS(templates, templatesDirectory+"index.html"))
16)
17
18func getHandler(w http.ResponseWriter) {
19	buf := &bytes.Buffer{}
20	err := indexTemplate.Execute(buf, nil)
21	if err != nil {
22		http.Error(w, err.Error(), http.StatusInternalServerError)
23		return
24	}
25
26	buf.WriteTo(w)
27}