Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minimal getting started doc in Readme #23

Closed
jkone27 opened this issue Oct 11, 2024 · 4 comments
Closed

Add minimal getting started doc in Readme #23

jkone27 opened this issue Oct 11, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@jkone27
Copy link

jkone27 commented Oct 11, 2024

suggestion, add minimal getting started code docs in readme,
so people can quickly get started without diving deep into other docs or tests or samples

e.g. in fsx, is there a way to make configuration more fluent, like Saturn or Falco? or maybe instead of CE using some adapter functions so configuration can be chained simply with |>

#load "runtime-scripts/Microsoft.AspNetCore.App-latest-8.fsx"
#r "nuget: Oxpecker"

open Microsoft.AspNetCore.Builder
open Microsoft.Extensions.DependencyInjection
open Oxpecker

let endpoints = [
    route "/hello" ("Hello World!" |> text)
    route "/hello-json" ("""{ "Hello": "World!" }""" |> json)
]

let configure (builder: WebApplicationBuilder) =
    builder.Services.AddRouting().AddOxpecker() |> ignore
    builder.Build()

let configureApp (app: WebApplication) =
    app.UseRouting().UseOxpecker(endpoints) |> ignore
    app

let webApp = 
    WebApplication.CreateBuilder()
    |> configure
    |> configureApp

webApp.Run()
@Lanayx
Copy link
Owner

Lanayx commented Oct 11, 2024

@jkone27 Will reference to the Empty example work?
https://github.com/Lanayx/Oxpecker/blob/develop/examples/Empty/Program.fs

As for #load "runtime-scripts/Microsoft.AspNetCore.App-latest-8.fsx" - do you want to contribute it? If yes, you can make a PR and we can add this as example of how to run Oxpecker from script

@jkone27
Copy link
Author

jkone27 commented Oct 11, 2024

sure, i posted an example also for openapi that doesnt seem to work, if u want to try it. opened separate issue, glad to contribute to docs sure

Lanayx added a commit that referenced this issue Oct 11, 2024
@Lanayx
Copy link
Owner

Lanayx commented Oct 11, 2024

I've added a documentation change, also wanted to comment on this

e.g. in fsx, is there a way to make configuration more fluent, like Saturn or Falco?

You won't believe, but one of the main reasons I created Oxpecker instead of going with Falco or Saturn is that I didn't like their builders approach for configuration :) And it seems to be the right choice, since as far as I know recently Falco got rid of builders as well (even though it was a breaking change).

@Lanayx
Copy link
Owner

Lanayx commented Oct 13, 2024

Closing as starting doc was updated, any work regarding script support should relate to #10

@Lanayx Lanayx closed this as completed Oct 13, 2024
@Lanayx Lanayx added the documentation Improvements or additions to documentation label Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants