From 67ae890717120f02cf3e75379b2c8e0c934f1907 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Thu, 2 Jan 2020 15:42:24 +0200 Subject: [PATCH] fsharp(todolist-api): refactor: added a few random type definitions Signed-off-by: prescientmoon --- fsharp/todolist-api/src/App.fs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fsharp/todolist-api/src/App.fs b/fsharp/todolist-api/src/App.fs index a4eede5..bb6b5f4 100644 --- a/fsharp/todolist-api/src/App.fs +++ b/fsharp/todolist-api/src/App.fs @@ -25,7 +25,7 @@ module App = open Utils open Db - let todoById (id) = + let todoById (id): WebPart = let todo = Context.getContext() |> Queries.getTodosById id @@ -35,7 +35,7 @@ module App = | Some inner -> inner |> jsonToString |> OK | None -> id |> sprintf "Cannot find todo with id %i" |> NOT_FOUND - let updateTodo (id) = + let updateTodo (id): WebPart = let dbContext = Context.getContext() let todo = dbContext |> Queries.getTodosById id @@ -59,6 +59,7 @@ module App = | None -> id |> sprintf "Cannot find todo with id %i" |> NOT_FOUND + let mainWebPart: WebPart = choose [ GET >=> pathScan "/todos/%i" todoById PUT >=> pathScan "/todos/%i" updateTodo]