newsbot-api/main.go
James Tombleson f01a8ff592
Features/swagger update (#14)
* ArticlesByTag added

* format cleanup
2022-07-13 21:31:53 -07:00

31 lines
638 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)
}
}