From d17bb903a66c2f551cadda4c51a6747c42440ae3 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 30 Mar 2020 09:25:49 -0700 Subject: Handle /ns endpoint with 501 --- Run/Que.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Run/Que.hs') diff --git a/Run/Que.hs b/Run/Que.hs index 8171fbe..aee021d 100644 --- a/Run/Que.hs +++ b/Run/Que.hs @@ -28,7 +28,7 @@ import Data.Text.Lazy ( Text , fromStrict ) import qualified Data.Text.Lazy as Text -import GHC.Base ( String ) +import qualified Network.HTTP.Types.Status as Http import qualified Network.Wai as Wai import qualified Network.Wai.Handler.Warp as Warp import Network.Wai.Middleware.RequestLogger @@ -70,6 +70,13 @@ routes :: Scotty.ScottyT Text App () routes = do Scotty.middleware logStdoutDev + let quepath = "^/([[:alnum:]_]*)/([[:alnum:]_/]*)$" + + Scotty.matchAny (Scotty.regex "^/([[:alnum:]_]*)/?$") <| do + -- matches '/ns' and '/ns/' but not '/ns/path' + Scotty.status Http.notImplemented501 + Scotty.text "namespace management coming soon" + -- | Receive a value from a que. Blocks until a value is received, -- then returns. If 'poll=true', then stream data from the Que to the -- client. @@ -129,9 +136,6 @@ insertQue ns qp q as = as { ques = newQues } newQues = HashMap.insert ns newQbase (ques as) newQbase = HashMap.insert qp q <| grab ns <| ques as -quepath :: GHC.Base.String -quepath = "^/([[:alnum:]_]*)/([[:alnum:]_/]*)$" - extract :: Scotty.ActionT Text App (Namespace, Quepath) extract = do ns <- Scotty.param "0" -- cgit v1.2.3