added api to see creds
This commit is contained in:
parent
4e5f3a0133
commit
ca118d0638
9
main.go
9
main.go
@ -46,6 +46,14 @@ func passHandler(resp http.ResponseWriter, req *http.Request) {
|
||||
http.Redirect(resp, req, "/", http.StatusTemporaryRedirect)
|
||||
}
|
||||
|
||||
func credHandler(resp http.ResponseWriter, req *http.Request) {
|
||||
b, err := json.Marshal(creds)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
resp.Write(b)
|
||||
}
|
||||
|
||||
func init_db() {
|
||||
b, err := ioutil.ReadFile(*db_file)
|
||||
if err != nil {
|
||||
@ -63,6 +71,7 @@ func main() {
|
||||
init_db()
|
||||
http.HandleFunc("/", homeHandler)
|
||||
http.HandleFunc("/pass", passHandler)
|
||||
http.HandleFunc("/api/1.0/creds/", credHandler)
|
||||
http.Handle("/s/", http.StripPrefix("/s/",
|
||||
http.FileServer(http.Dir(*static_files))))
|
||||
if err := http.ListenAndServe(*addr, nil); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user