-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathep_stu.go
More file actions
30 lines (25 loc) · 922 Bytes
/
ep_stu.go
File metadata and controls
30 lines (25 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package main
import (
"encoding/json"
"fmt"
"log/slog"
"net/http"
)
func (app *App) handleStu(w http.ResponseWriter, r *http.Request, sui *UserInfoStudent) {
app.logRequestStart(r, "handleStu", slog.Int64("student_id", sui.ID))
if r.Method != http.MethodGet {
app.respondHTTPError(r, w, http.StatusMethodNotAllowed, "Method Not Alloewd", nil, slog.Int64("student_id", sui.ID))
return
}
if _, err := fmt.Fprint(w, `Hi! You have logged on as a student (see info below) but there's
no student UI yet (poke Henry!). In the future there will be a JS SPA
over here. Note that all auth-related things are already done; you can
use the network inspector to check cookie status.
`); err != nil {
app.logError(r, logMsgStudentPlaceholderWrite, slog.Any("error", err))
return
}
if err := json.NewEncoder(w).Encode(sui); err != nil {
app.logError(r, logMsgStudentInfoEncodeError, slog.Any("error", err))
}
}