yeet my meet

This commit is contained in:
Expand-sys 2022-08-16 20:11:02 +10:00
parent 06d0f2b7db
commit bd9b428ff8
2 changed files with 61 additions and 4 deletions

30
main.go
View file

@ -12,18 +12,40 @@ import (
"github.com/gorilla/mux"
)
func YourHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Gorilla!\n"))
func routeHandler(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
http.Error(w, "404 not found", http.StatusNotFound)
return
}
if r.Method != "GET" {
http.Error(w, "method is not supported", http.StatusNotFound)
return
}
http.ServeFile(w, r, "static/index.html")
}
func formHandler(w http.ResponseWriter, r *http.Request) {
if err := r.ParseMultipartForm(2048); err != nil {
fmt.Fprintf(w, "ParseMultipartForm() err: %v", err)
return
}
fmt.Fprintf(w, "POST request successful")
//uncommentfile := r.FormValue("file")
//uncommenttext := r.FormValue("text")
}
func main() {
text := "this is a test"
testimage := Request{"img.png", "Garamond.ttf", text, 255, 0, 0}
TextOnImg(testimage)
r := mux.NewRouter()
// Routes consist of a path and a handler function.
r.HandleFunc("/", YourHandler)
r.HandleFunc("/", routeHandler).
Methods("GET")
r.HandleFunc("/submit", formHandler).
Methods("POST")
// Bind to a port and pass our router in
log.Fatal(http.ListenAndServe(":8000", r))

35
static/index.html Normal file
View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Enemy Felled</title>
<link rel="stylesheet" href="/stylesheets/style.css" />
<script src="/js/script.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.1.0/uuidv4.min.js"></script>
<body>
<img src="/enemyfelled.png" /></marquee>
<form id=upload enctype="multipart/form-data">
<h2>a dumb lil elden ring generator i made (ALPHA)</h2>
<input type="file" name="file" required></br></br>
<h3>Enter your text</h3>
<input type="text" name="text" id="text" required>
</form>
<center><button type=submit onclick=butts() class="btn btn-primary">Upload</button></center>
<center>
<h4>More options coming soon same with some styling to make it not look like another of my projects</h4>
</center>
<div class="mention">
<center>
<p>Big thanks to</p>
<a href="https://TAWAN475.dev/eldenring">tawan475.dev</a></marquee>
<p>btw web design is my passion</p>
</center>
</div>
</body>
</html>