diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/RestService.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/RestService.hs b/src/RestService.hs index 3bad9b6..983deda 100755 --- a/src/RestService.hs +++ b/src/RestService.hs @@ -82,6 +82,12 @@ routes state = do S.json . fmap (evalTableExpressions . flip TableExpressions [ex]) =<< liftIO (getTable state id) + post "/t/:id/e" $ do + id <- S.pathParam "id" + exs <- S.jsonData + S.json + . fmap (evalTableExpressions . flip TableExpressions exs) + =<< liftIO (getTable state id) post "/t/:id" $ do id <- S.pathParam "id" S.json =<< liftIO . setTable state id =<< S.jsonData @@ -89,7 +95,11 @@ routes state = do id <- S.pathParam "id" S.json =<< liftIO . insertRow state id =<< S.jsonData get "/:expr" $ - S.text =<< S.pathParam "expr" + S.text + . (fromMaybe "") + . result + . (ExprReq <*> eval M.empty) + =<< S.pathParam "expr" post "/eval" $ S.json . (ExprReq <*> eval M.empty) . expression =<< S.jsonData |