newsbot-api/main.go
James Tombleson 713205bb03
Basic routes have been added (#10)
* basic routes are working with db context

* swagger is working along with swag gen

* cron was updated with a class and better db context, untested though

* sourcelist command added

* lost the pg package but added it back

* Updated the api startup for cron and api

* updated source routes and started to add article routes

* Updated cron add func calls

* updated swagger

* keeping articles basic for now as I dont need to pull them in yet

* swagger update

* added getarticlesbysourceid call

* adding the subscriptions table to track who to send notifications and where

* removed legacy columns from discordwebhooks that are no longer needed.

* added discord webhook routes

* updated routes

* Minor change to schema

* Updated routes to support subscriptions

* ignore .vscode
2022-06-19 22:02:44 -07:00

30 lines
635 B
Go

package main
import (
"context"
"fmt"
"net/http"
_ "github.com/jtom38/newsbot/collector/docs"
"github.com/jtom38/newsbot/collector/routes"
"github.com/jtom38/newsbot/collector/services/cron"
)
// @title NewsBot collector
// @version 0.1
// @BasePath /api
func main() {
ctx := context.Background()
c := cron.New(ctx)
c.Start()
server := routes.NewServer(ctx)
fmt.Println("API is online and waiting for requests.")
fmt.Println("API: http://localhost:8081/api")
fmt.Println("Swagger: http://localhost:8081/swagger/index.html")
err := http.ListenAndServe(":8081", server.Router)
if err != nil { panic(err) }
}