This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
import { Hero } from './hero'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './Component.html', | |
styleUrls : ['./Component.css'] | |
}) | |
export class AppComponent { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// imports | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { NgModule } from '@angular/core'; | |
import { FormsModule } from '@angular/forms'; | |
import { HttpClientModule } from '@angular/common/http'; | |
import { AppComponent } from './app.component'; | |
import { ItemDirective } from './item.directive'; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fizzBuzz x = | |
match x with | |
| _ when (x % 15) = 0 -> "FizzBuzz" | |
| _ when (x % 3) = 0 -> "Fizz" | |
| _ when (x % 5) = 0 -> "Buzz" | |
| _ -> "" | |
let fizzBuzzTo max = | |
[1..max] | |
|> List.iter (fun number -> printfn "%d %s" number (fizzBuzz number)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let topRouter = scope { | |
pipe_through headerPipe | |
not_found_handler (text "404") | |
get "/" helloWorld | |
get "/a" helloWorld2 | |
getf "/name/%s" helloWorldName | |
getf "/name/%s/%i" helloWorldNameAge | |
//scopes can be defined inline to simulate `subRoute` combinator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let users = | |
freyaMachine { | |
methods [ GET; OPTIONS; POST ] | |
availableMediaTypes MediaType.json | |
doPost createUser | |
handleOk listUsers } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Giraffe | |
let webApp = | |
choose [ | |
route "/ping" >=> text "pong" | |
route "/" >=> htmlFile "/pages/index.html" ] | |
type Startup() = | |
member __.ConfigureServices (services : IServiceCollection) = | |
// Register default Giraffe dependencies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.Threading | |
open Suave | |
[<EntryPoint>] | |
let main argv = | |
let cts = new CancellationTokenSource() | |
let conf = { defaultConfig with cancellationToken = cts.Token } | |
let listening, server = startWebServerAsync conf (Successful.OK "Hello World") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module viewfiles.Main | |
open System | |
open Nancy.Hosting | |
type DemoApp () = | |
inherit NancyModule() | |
do | |
let Get = base.Get | |
Get.["/"] <- fun parameters -> "Hello from Nancy" :> obj |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Todos | |
open System; | |
open System.IO; | |
open Microsoft.AspNetCore.Builder; | |
open Microsoft.AspNetCore.Hosting; | |
open Microsoft.Extensions.Logging; | |
open Funq; | |
open ServiceStack; | |
open ServiceStack.Configuration; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open WebSharper | |
open WebSharper.JavaScript | |
open WebSharper.JQuery | |
open WebSharper.UI | |
open WebSharper.UI.Client | |
[<JavaScript>] | |
module Code = | |
// This creates a typed access to the HTML template (see the Markup tab) | |
type IndexTemplate = Templating.Template<Snippet.IndexHtml> |