Routing, templating, and database handling

This commit is contained in:
max
2022-10-20 11:59:33 -05:00
parent 38352de02f
commit e73c006550
10 changed files with 204 additions and 0 deletions

13
templates/base.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SiteName - {{ template "pageTitle" }}</title>
</head>
<body>
{{ template "content" . }}
</body>
<footer>
<p>SiteName - Powered by Go!</p>
</footer>
</html>

View File

@ -0,0 +1,5 @@
{{ define "pageTitle" }}Home{{ end }}
{{ define "content" }}
{{ .Test }}
{{ end }}

View File

@ -0,0 +1,11 @@
{{ define "pageTitle" }}Login{{ end }}
{{ define "content" }}
<form action="/login-handle" method="post">
<label for="username">Username:</label><br>
<input type="text" id="username" name="username" value="John"><br><br>
<label for="password">Password:</label><br>
<input type="password" id="password" name="password"><br><br>
<input type="submit" value="Submit">
</form>
{{ end }}

View File

@ -0,0 +1,11 @@
{{ define "pageTitle" }}Register{{ end }}
{{ define "content" }}
<form action="/register-handle" method="post">
<label for="username">Username:</label><br>
<input type="text" id="username" name="username" value="John"><br><br>
<label for="password">Password:</label><br>
<input type="password" id="password" name="password"><br><br>
<input type="submit" value="Submit">
</form>
{{ end }}