package server-reason-react

  1. Overview
  2. Docs
Rendering React components on the server natively

Install

Dune Dependency

Authors

Maintainers

Sources

server-reason-react-0.3.1.tbz
sha256=b97fbe6a7c3e5e1a7775e0f6498f257acaaa7e272177a9a3e0e50b7a49408d7c
sha512=b27a94618c367c80efef83a41c2a59c9cc7848fd753049ed40fa1f2cface1ef34cf3a995835bf08e2eb59c3186911f429b4706ed07dcb9724df6af5eb012a31d

doc/server-reason-react.url_native/URL/index.html

Module URL

URL module is universal and has 2 implementations with the same API:

  • url_js library is a wrapper around the URL API in the browser binded with Melange.
  • url_native library is a native implementation with ocaml-uri (RFC3986 URI parsing library for OCaml).

Setup with dune

Depending on you setup, you would need to add the following dependencies to your `dune` stanzas:

(library
  (name ...)
  (modes melange)
  (libraries (server-reason-react.url_js))

(library
  (name ...)
  (modes native)
  (libraries (server-reason-react.url_native))

Usage

    let url = URL.make("https://example.com:8080/path?query=1#hash");
    URL.protocol(url); (* => Some("https:") *)
    URL.hostname(url); (* => "example.com" *)
    URL.port(url); (* => Some("8080") *)
    URL.pathname(url); (* => "/path" *)
    URL.search(url); (* => Some("?query=1") *)
    URL.hash(url); (* => Some("#hash") *)

URL.SearchParams

module SearchParams : sig ... end

URL

type t
val makeExn : string -> t
val make : string -> t option
val makeWith : string -> base:string -> t
val hash : t -> string option
val setHash : t -> string -> t
val host : t -> string option
val setHost : t -> string -> t
val hostname : t -> string
val setHostname : t -> string -> t
val href : t -> string
val setHref : t -> string -> t
val origin : t -> string option
val password : t -> string option
val setPassword : t -> string -> t
val pathname : t -> string
val setPathname : t -> string -> t
val port : t -> string option
val setPort : t -> string -> t
val protocol : t -> string option
val setProtocol : t -> string -> t
val setSearch : t -> string -> t
val searchParams : t -> SearchParams.t
val username : t -> string option
val setUsername : t -> string -> t
val toString : t -> string
OCaml

Innovation. Community. Security.