-
Notifications
You must be signed in to change notification settings - Fork 18
Add express example #5
Comments
Actually we want to create a samples-node repo with express and other server-side samples. However, I haven't used Fable wit express myself that much. Maybe someone else has more experience? @et1975? |
That sounds great. App.fsx: #r "C:\temp\FableInterop\packages\Fable.Core\lib\netstandard1.6\Fable.Core.dll"
#r "C:\temp\FableInterop\packages\Fable.Import.Express\lib\netstandard1.6\Fable.Import.Express.dll"
open System
open Fable.Core
open Fable.Core.JsInterop
open Fable.Import
let app = express.Invoke()
app.get
(U2.Case1 "/",
fun (req:express.Request) (res:express.Response) _ ->
res.send(sprintf "Hello") |> box)
|> ignore
// Get PORT environment variable or use default
let port =
match unbox Node.``process``.env?PORT with
| Some x -> x | None -> 8080
// Start the server on the port
app.listen(port, unbox (fun () ->
printfn "Server started: http://localhost:%i/" port))
|> ignore
I'm also not really a seasoned fsharp dev, so I might just be missing a very basic thing here. |
Can you please try adding #r @"C:\temp\FableInterop\packages\Fable.Core\lib\netstandard1.6\Fable.Core.dll"
#r @"C:\temp\FableInterop\packages\Fable.Import.Express\lib\netstandard1.6\Fable.Import.Express.dll" That makes them verbatim strings, meaning |
No luck |
Ok, we'll try to add a Express sample that works with latest Fable :) Maybe @fable-compiler/documentation, @MangelMaxime can help with that? 😉 |
I've started porting our elmish-ws sample to latest Fable, it uses Express for websockets, will try to wrap it up soon. |
I'd like to see an express example using the latest and greatest fable.
The text was updated successfully, but these errors were encountered: