You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
538 B
Go
34 lines
538 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
|
|
"prayertimes/internal/api"
|
|
"prayertimes/internal/scrapeutils"
|
|
"prayertimes/pkg/diyanet"
|
|
)
|
|
|
|
func main() {
|
|
port, ok := os.LookupEnv("PORT")
|
|
if !ok {
|
|
port = "8000"
|
|
}
|
|
services := newServices()
|
|
app := api.New(services)
|
|
err := app.Listen(":" + port)
|
|
if err != nil {
|
|
log.Fatal().Err(err).Msg("exit with an error")
|
|
}
|
|
}
|
|
|
|
func newServices() api.Services {
|
|
d := diyanet.Diyanet{
|
|
FetcherFunc: scrapeutils.GetParsed,
|
|
}
|
|
return api.Services{
|
|
PrayerTimesProvider: d,
|
|
}
|
|
}
|