aboutsummaryrefslogtreecommitdiff
path: root/app/Main.hs
blob: 0b3165eb1c8adfed5047588c96142ecde1b15a4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{-# LANGUAGE DataKinds                  #-}
{-# LANGUAGE DeriveAnyClass             #-}
{-# LANGUAGE DeriveGeneric              #-}
{-# LANGUAGE DerivingStrategies         #-}
{-# LANGUAGE FlexibleInstances          #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures             #-}
{-# LANGUAGE LambdaCase                 #-}
{-# LANGUAGE RecordWildCards            #-}
{-# LANGUAGE StandaloneDeriving         #-}
{-# LANGUAGE StandaloneKindSignatures   #-}
{-# LANGUAGE TypeApplications           #-}
{-# LANGUAGE TypeFamilies               #-}
-- |

module Main where


import qualified Data.Aeson                           as A
import qualified Data.ByteString.Lazy                 as LB
import           Data.Default.Class                   (def)
import           Data.Maybe                           (fromJust, fromMaybe)
import           Data.Time.Calendar.MonthDay          (monthAndDayToDayOfYearValid)
import qualified Data.Time.Calendar.OrdinalDate       as Day
import           Network.Wai.Handler.Warp             (run)
import           Network.Wai.Middleware.RequestLogger (OutputFormat (..),
                                                       RequestLoggerSettings (..),
                                                       mkRequestLogger)

import           GTFS
import           Server


main :: IO ()
main = do
  gtfs <- loadGtfs "./gtfs.zip"
  app <- application gtfs
  loggerMiddleware <- mkRequestLogger
    $ def { outputFormat = Detailed True }
  putStrLn "starting server …"
  run 4000 (loggerMiddleware app)