James Tombleson
333a4f5345
* ran go mod tity * updated formatting and moved to using some common errors * some common source errors * bumped go version * a bulk of the work has been completed to parse twitch videos/users * Added twitch config values * added common errors * moved the scheduler to its own package to get it out of main and also start adding tests * added a new err for invalid author images * Updated an error used * tests updated to avoid name duplication * new func to replace the cached source recor and updated getcontent to return collected posts * updated scheduler ref * moved to services/cron
32 lines
784 B
Go
32 lines
784 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
"github.com/go-chi/chi/v5/middleware"
|
|
|
|
"github.com/jtom38/newsbot/collector/routes"
|
|
"github.com/jtom38/newsbot/collector/services/cron"
|
|
)
|
|
|
|
func main() {
|
|
//dc := database.NewDatabaseClient()
|
|
//err := dc.Diagnosis.Ping()
|
|
//if err != nil { log.Fatalln(err) }
|
|
cron.EnableScheduler()
|
|
|
|
app := chi.NewRouter()
|
|
app.Use(middleware.Logger)
|
|
app.Use(middleware.Recoverer)
|
|
|
|
//app.Mount("/swagger", httpSwagger.WrapHandler)
|
|
app.Mount("/api", routes.RootRoutes())
|
|
|
|
log.Println("API is online and waiting for requests.")
|
|
log.Println("API: http://localhost:8081/api")
|
|
//log.Println("Swagger: http://localhost:8080/swagger/index.html")
|
|
err := http.ListenAndServe(":8081", app)
|
|
if err != nil { log.Fatalln(err) }
|
|
} |