aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordan <[email protected]>2024-04-20 14:00:46 -0400
committerdan <[email protected]>2024-04-20 14:00:46 -0400
commit66666390b3c553bdeebb0bcf8a6ddc7fd1e1d72b (patch)
tree0cdce5f95f83640464f3c87e0b395822ea7ab487
parent9331780bedd675ece82aebd1f12ce8b053a618f8 (diff)
downloadbizexp-66666390b3c553bdeebb0bcf8a6ddc7fd1e1d72b.tar.gz
bizexp-66666390b3c553bdeebb0bcf8a6ddc7fd1e1d72b.tar.bz2
bizexp-66666390b3c553bdeebb0bcf8a6ddc7fd1e1d72b.zip
chore: don't use deprecated param and liftAndCatchIO functions
-rwxr-xr-xsrc/RestService.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/RestService.hs b/src/RestService.hs
index 6d92e69..3bad9b6 100755
--- a/src/RestService.hs
+++ b/src/RestService.hs
@@ -75,21 +75,21 @@ routes state = do
get "/t/dummy" $
S.json $ evalTableExpressions (TableExpressions dummyTable ["sum(2,3,5)", "any(0,0,1)", "sum(age, -10)", "any(0,1)"])
get "/t/:id" $
- S.json =<< liftAndCatchIO . getTable state =<< S.param "id"
+ S.json =<< liftIO . getTable state =<< S.pathParam "id"
get "/t/:id/e/:e" $ do
- id <- S.param "id"
- ex <- S.param "e"
+ id <- S.pathParam "id"
+ ex <- S.pathParam "e"
S.json
. fmap (evalTableExpressions . flip TableExpressions [ex])
- =<< liftAndCatchIO (getTable state id)
+ =<< liftIO (getTable state id)
post "/t/:id" $ do
- id <- S.param "id"
- S.json =<< liftAndCatchIO . setTable state id =<< S.jsonData
+ id <- S.pathParam "id"
+ S.json =<< liftIO . setTable state id =<< S.jsonData
post "/t/:id/row" $ do
- id <- S.param "id"
- S.json =<< liftAndCatchIO . insertRow state id =<< S.jsonData
+ id <- S.pathParam "id"
+ S.json =<< liftIO . insertRow state id =<< S.jsonData
get "/:expr" $
- S.text =<< S.param "expr"
+ S.text =<< S.pathParam "expr"
post "/eval" $
S.json . (ExprReq <*> eval M.empty) . expression =<< S.jsonData