package http_server

import (
	"log"
	"net/http"

	"github.com/Vomitblood/cspj-application/server/internal/sql_injection"
)

// setup the http server
func ServeApi() {
	http.HandleFunc("/execute-sql", sql_injection.ExecuteSql)
	http.HandleFunc("/secure-execute-sql", sql_injection.SecureExecuteSql)
	http.HandleFunc("/secure-get-user", sql_injection.SecureExecuteSql)
	log.Println("Server is running on http://localhost:3001")
	if err := http.ListenAndServe(":3001", nil); err != nil {
		log.Fatalf("Failed to start server: %v", err)
	}
}
