Skip to content

Commit

Permalink
Enable CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Dec 13, 2022
1 parent a8584b0 commit d648b9c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Server/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,13 @@ let topLevelRouter = router {
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.StaticFiles

// https://cors-test.codehappy.dev/?url=https%3A%2F%2Fswate.nfdi4plants.org%2Fapi%2FIOntologyAPIv2%2FgetAllOntologies&method=get
/// Enable CORS. Makes external access of Swate API possible
let configureServices (services:IServiceCollection) =
services
.AddCors()
.AddGiraffe()

/// Allows serving .yaml files directly
let config (app:IApplicationBuilder) =
let provider = new FileExtensionContentTypeProvider()
Expand All @@ -364,6 +371,7 @@ let app = application {
url "http://0.0.0.0:5000" //"http://localhost:5000/"
use_router topLevelRouter
app_config config
service_config configureServices
memory_cache
use_static "public"
use_gzip
Expand Down

0 comments on commit d648b9c

Please sign in to comment.