module Route (Route (..), parser) where import Data.Attoparsec.Char8 qualified as P data Route = SchemaJson String | Query | SchemaVersion | Collections deriving (Show) parser :: P.Parser Route parser = ( P.choice [ pure Collections <* P.string "/collections", pure SchemaVersion <* P.string "/schemaVersion", SchemaJson <$> (P.string "/" *> P.manyTill P.anyChar (P.string ".schema.json")), pure Query <* P.string "/" ] ) <* P.endOfInput