2024-10-11 11:38:08 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2024-10-12 09:55:58 +03:00
|
|
|
"net/http"
|
2024-10-12 20:41:30 +03:00
|
|
|
|
|
|
|
"git.a71.su/Andrew71/pye/storage"
|
|
|
|
"git.a71.su/Andrew71/pye/storage/sqlite"
|
2024-10-11 11:38:08 +03:00
|
|
|
)
|
|
|
|
|
2024-10-12 20:41:30 +03:00
|
|
|
var data storage.Storage = sqlite.MustLoadSQLite()
|
|
|
|
|
2024-10-11 11:38:08 +03:00
|
|
|
func main() {
|
2024-10-12 10:44:12 +03:00
|
|
|
fmt.Println("=== Working on port 7102 ===")
|
2024-10-11 11:38:08 +03:00
|
|
|
|
2024-10-12 09:55:58 +03:00
|
|
|
router := http.NewServeMux()
|
2024-10-11 11:38:08 +03:00
|
|
|
|
2024-10-12 16:59:47 +03:00
|
|
|
router.HandleFunc("GET /pem", publicKey)
|
2024-10-11 11:38:08 +03:00
|
|
|
|
2024-10-12 09:55:58 +03:00
|
|
|
router.HandleFunc("POST /register", Register)
|
|
|
|
router.HandleFunc("POST /login", Login)
|
2024-10-11 11:38:08 +03:00
|
|
|
|
2024-10-12 18:39:38 +03:00
|
|
|
// Note: likely temporary, possibly to be replaced by a fake "frontend"
|
2024-10-12 20:41:30 +03:00
|
|
|
router.HandleFunc("GET /login", Login)
|
2024-10-12 18:39:38 +03:00
|
|
|
router.HandleFunc("GET /register", Register)
|
2024-10-12 16:59:47 +03:00
|
|
|
|
2024-10-12 09:55:58 +03:00
|
|
|
http.ListenAndServe(":7102", router)
|
2024-10-11 11:38:08 +03:00
|
|
|
}
|