James Tombleson
a1324ee1c1
* basic output looks to be working * cron was updated to add to the queue and post messages * new route to make discord webhook subscriptions * updated swag tags * swag * Updated delete subscription call * removed the time value as it throws off the msg template * updated logging * updated swagger * updated new subscription route * Updated logging and remove items from the queue if they dont have a subscription * updated getArticles to return the 50 newest for the portal * added endpoint to see if an item exists already * formatting * updated listArticles * added colors and updated the image * Updated to use the pointer in twitch * added the twitch login command to cron... it works now * found a better way to disable http2 for reddit. Test worked right away too * updated the cron tasks to run collected once and hour or longer depending on the service
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
package routes
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
)
|
|
|
|
func RootRoutes() chi.Router {
|
|
app := chi.NewRouter()
|
|
app.Route("/", func(r chi.Router) {
|
|
r.Get("/helloworld", helloWorld)
|
|
r.Get("/ping", ping)
|
|
r.Route("/hello/{who}", func(r chi.Router) {
|
|
r.Get("/", helloWho)
|
|
})
|
|
})
|
|
return app
|
|
}
|
|
|
|
// HelloWorld
|
|
// @Summary Responds back with "Hello world!"
|
|
// @Produce plain
|
|
// @Tags Debug
|
|
// @Router /helloworld [get]
|
|
func helloWorld(w http.ResponseWriter, r *http.Request) {
|
|
w.Write([]byte("Hello World!"))
|
|
}
|
|
|
|
// Ping
|
|
// @Summary Sends back "pong". Good to test with.
|
|
// @Produce plain
|
|
// @Tags Debug
|
|
// @Router /ping [get]
|
|
func ping(w http.ResponseWriter, r *http.Request) {
|
|
msg := "pong"
|
|
w.Write([]byte(msg))
|
|
}
|
|
|
|
// HelloWho
|
|
// @Summary Responds back with "Hello x" depending on param passed in.
|
|
// @Param who path string true "Who"
|
|
// @Produce plain
|
|
// @Tags Debug
|
|
// @Router /hello/{who} [get]
|
|
func helloWho(w http.ResponseWriter, r *http.Request) {
|
|
msg := fmt.Sprintf("Hello %v", chi.URLParam(r, "who"))
|
|
w.Write([]byte(msg))
|
|
}
|