Extract chat, profile, types, and user data into separate files. Embed CSS via go:embed. Add a layout with nav, session-based profile persistence, and a middleware guard that redirects to /profile when no identity is set.
23 lines
472 B
Go
23 lines
472 B
Go
package main
|
|
|
|
import "math/rand"
|
|
|
|
var quoteIdx = rand.Intn(len(devQuotes))
|
|
var devQuotes = []string{
|
|
"Just use NATS.",
|
|
"Pub/sub all the things!",
|
|
"Messages are the new API.",
|
|
"JetStream for durability.",
|
|
"No more polling.",
|
|
"Event-driven architecture FTW.",
|
|
"Decouple everything.",
|
|
"NATS is fast.",
|
|
"Subjects are like topics.",
|
|
"Request-reply is cool.",
|
|
}
|
|
|
|
func randomDevQuote() string {
|
|
quoteIdx = (quoteIdx + 1) % len(devQuotes)
|
|
return devQuotes[quoteIdx]
|
|
}
|