diff --git a/build.fsx b/build.fsx index 8d82eb2..65fa823 100644 --- a/build.fsx +++ b/build.fsx @@ -2,7 +2,7 @@ open Fake open System -let buildDir = "./build/" +let buildDir = "build" /// Path to the Vue app let appPath = "src" @@ "app" @@ -39,7 +39,7 @@ Target "BuildApi" (fun _ -> Target "Publish" (fun _ -> ExecProcess (fun info -> info.FileName <- "dotnet" - info.Arguments <- """publish -o ..\..\build""" + info.Arguments <- sprintf "publish -o %s" (".." @@ ".." @@ buildDir) info.WorkingDirectory <- apiPath) TimeSpan.MaxValue |> ignore ) diff --git a/src/api/App.fs b/src/api/App.fs index 98830c8..e868f5c 100644 --- a/src/api/App.fs +++ b/src/api/App.fs @@ -149,7 +149,6 @@ module Route = /// /api/journal ~ All active prayer requests for a user let journal = "/api/journal" - /// All WebParts that compose the public API module WebParts = @@ -173,12 +172,20 @@ module WebParts = let reqs = Data.Requests.allForUser (defaultArg (read ctx "user") "") dataCtx JSON reqs) + /// API-specific routes + let apiRoutes = + choose [ + GET >=> path Route.journal >=> viewJournal + errorJSON HttpCode.HTTP_404 "Page not found" + ] + /// Suave application let app = Auth.loggedOn >=> choose [ - GET >=> path Route.journal >=> viewJournal - errorJSON HttpCode.HTTP_404 "Page not found" + path "/api" >=> apiRoutes + Files.browseHome + Files.browseFileHome "index.html" ] [] diff --git a/src/api/MyPrayerJournal.fsproj b/src/api/MyPrayerJournal.fsproj index 5549912..e7dee42 100644 --- a/src/api/MyPrayerJournal.fsproj +++ b/src/api/MyPrayerJournal.fsproj @@ -14,12 +14,8 @@ - - PreserveNewest - - - Always - + +