Print server address and termination hint

This commit is contained in:
Stavros Polymenis 2017-10-20 22:41:59 +01:00
parent 05ccdc38ee
commit 192df0f191

View File

@ -141,21 +141,23 @@ let () =
>>= html_response
in
print_endline @@ "Server address: " ^ Uri.to_string web_config.Configuration.url;
print_endline @@ "Press Ctrl+C to stop.";
App.empty
|> App.port (match Uri.port web_config.Configuration.url with Some p -> p | None -> 3666)
|> middleware @@
Middleware.static
~local_path:(Fpath.to_string web_config.Configuration.static)
~uri_prefix:"/static"
|> get "/:ttl" @@ view_note "ttl" lgrn (L.note_with_alias lgrn)
|> post "/post.note" @@ post_note lgrn
|> get "/edit.note/:ttl" @@ edit_note "ttl" lgrn (L.note_with_alias lgrn)
|> get "/new.note" (fun _ -> lwt_blanknote () >|= form_of_note >>= html_response)
|> get "/topic/:topic" @@ list_notes_with_topic "topic" lgrn
|> get "/note/:ttl" @@ view_note "ttl" lgrn (L.note_with_alias lgrn)
|> get "/!/:ttl" @@ view_note "ttl" lgrn (fun t -> match L.latest_entry lgrn t with
| Some meta -> L.note_with_id lgrn meta.Logarion.Meta.uuid
| None -> None)
|> get "/feed.atom" @@ atom_response lgrn
|> get "/" @@ list_notes "p" lgrn
|> App.run_command
|> App.port (match Uri.port web_config.Configuration.url with Some p -> p | None -> 3666)
|> middleware @@
Middleware.static
~local_path:(Fpath.to_string web_config.Configuration.static)
~uri_prefix:"/static"
|> get "/:ttl" @@ view_note "ttl" lgrn (L.note_with_alias lgrn)
|> post "/post.note" @@ post_note lgrn
|> get "/edit.note/:ttl" @@ edit_note "ttl" lgrn (L.note_with_alias lgrn)
|> get "/new.note" (fun _ -> lwt_blanknote () >|= form_of_note >>= html_response)
|> get "/topic/:topic" @@ list_notes_with_topic "topic" lgrn
|> get "/note/:ttl" @@ view_note "ttl" lgrn (L.note_with_alias lgrn)
|> get "/!/:ttl" @@ view_note "ttl" lgrn (fun t -> match L.latest_entry lgrn t with
| Some meta -> L.note_with_id lgrn meta.Logarion.Meta.uuid
| None -> None)
|> get "/feed.atom" @@ atom_response lgrn
|> get "/" @@ list_notes "p" lgrn
|> App.run_command