James Tombleson
75b66dd625
* Using sqlc to generate queries and goose for migrations. The intial tests look good. * moving the old calls away for now. Might use this in a package later on. * Added postgres driver * Updated the dockerfile to support sql migrations * added sqlc config file * updated schema and starting a seed script * updated models to use the database ones * updated reddit cron to talk to the db * added env for sql connection string * got the reddit source working with the db and posting articles * added sql packages * added rule to ignore dev sql file * added migration down statement for rolling back * updated cron for reddit and youtube * Updated reddit to follow a new standard pattern * updated youtube to follow new patterns * updated tests and brought them to the standard * updated the seed migration * all cron tasks should feed the db now * updated app init * bumped docker to 1.18.3 * disabled remote tests given secrets and lack of interfaces currently to run tests
32 lines
722 B
Go
32 lines
722 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"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() {
|
|
ctx := context.Background()
|
|
|
|
cron.EnableScheduler(ctx)
|
|
|
|
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) }
|
|
} |