Skip to content

Instantly share code, notes, and snippets.

@nojaf
Created September 30, 2017 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nojaf/f4ce4216c68e7c6611a8afc79c6810fb to your computer and use it in GitHub Desktop.
Save nojaf/f4ce4216c68e7c6611a8afc79c6810fb to your computer and use it in GitHub Desktop.
Add cors to giraffe
// <PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.0.0" />
let configureApp (app : IApplicationBuilder) =
app.UseGiraffeErrorHandler errorHandler
app.UseCors(fun builder ->
builder.WithOrigins("http://localhost:8080").AllowAnyMethod().AllowAnyHeader() |> ignore
) |> ignore
let configureServices (services : IServiceCollection) =
services.AddCors() |> ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment