Suave serves Vue files
- Only send the 404 for /api routes; otherwise, serve files from wwwroot, and send index.html if the path doesn't exist, so Vue can handle it - Minor build file tweaks
This commit is contained in:
@@ -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"
|
||||
]
|
||||
|
||||
[<EntryPoint>]
|
||||
|
||||
@@ -14,12 +14,8 @@
|
||||
<Compile Include="Migrations/20170104023341_InitialDb.fs" />
|
||||
<Compile Include="Migrations/DataContextModelSnapshot.fs" />
|
||||
<Compile Include="App.fs" />
|
||||
<Content Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="wwwroot/**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="appsettings.json" CopyToOutputDirectory="Always" />
|
||||
<None Include="wwwroot/**" CopyToOutputDirectory="Always" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FSharp.Core" Version="4.2.3" />
|
||||
|
||||
Reference in New Issue
Block a user