summaryrefslogtreecommitdiff
path: root/Run
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-03-30 09:25:49 -0700
committerBen Sima <ben@bsima.me>2020-03-30 09:25:49 -0700
commitd17bb903a66c2f551cadda4c51a6747c42440ae3 (patch)
tree4df1baeec4de507b1897f02a35f3bc3e23afc649 /Run
parentef3db8a4114aa0ef66ea5f9e15bbc83e1f36f33a (diff)
Handle /ns endpoint with 501
Diffstat (limited to 'Run')
-rw-r--r--Run/Que.hs12
1 files changed, 8 insertions, 4 deletions
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"