Added go code

This commit is contained in:
Logan Gatlin 2024-09-25 18:05:04 -05:00
parent e9f29caa0d
commit c4ab29f648
7 changed files with 52 additions and 19 deletions

3
go.mod Normal file
View file

@ -0,0 +1,3 @@
module github.com/adanrsantos/ThePlaceHolders
go 1.23.1

31
server.go Normal file
View file

@ -0,0 +1,31 @@
package main
import (
"fmt"
"net/http"
)
const ADDRESS = "127.0.0.1"
const PORT = "8080"
func get_canvas(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "test data")
}
func main() {
// Host static files
static_files := http.FileServer(http.Dir("static/"))
http.Handle("/", static_files)
// Response generated by code
http.HandleFunc("/get-canvas", get_canvas)
// Start web server at 127.0.0.1:8080
e := http.ListenAndServe(ADDRESS+":"+PORT, nil)
// Print any errors
if e != nil {
fmt.Println(e)
} else {
fmt.Println("Started server successfully")
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -5,9 +5,21 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>UTSA Placeholders</title>
<link rel="stylesheet" href="/bootstrap.min.css">
<script src="/bootstrap.bundle.min.js"/>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</head>
<body>
<h1>
Hello Placeholders
</h1>
<ul>
<li>
<a href="/register.html"> Register </a>
</li>
<li>
<a href="/login.html"> Login </a>
</li>
</ul>
</body>
</html>

View file

@ -5,8 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>UTSA Placeholders</title>
<link rel="stylesheet" href="/bootstrap.min.css">
<script src="/bootstrap.bundle.min.js"/>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</head>
<body>
</body>

View file

@ -5,8 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>UTSA Placeholders</title>
<link rel="stylesheet" href="/bootstrap.min.css">
<script src="/bootstrap.bundle.min.js"/>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</head>
<body>
</body>