diff --git a/dev/API/assets.html b/dev/API/assets.html index 26ad99808..11416fe20 100644 --- a/dev/API/assets.html +++ b/dev/API/assets.html @@ -9,18 +9,18 @@ script(src = "/stippleui.jl/master/assets/js/vuedraggable.umd.min.js") script(src = "/stippleui.jl/master/assets/js/qsortabletree.js") ] -Stipple.DEPS[:qdraggabletree] = draggabletree_depssource
Genie.Assets.AssetsConfigType
mutable struct AssetsConfig

Manages the assets configuration for the current package. Define your own instance of AssetsConfig if you want to add support for asset management for your package through Genie.Assets.

source
Genie.Assets.assets_config!Function
assets_config!(packages::Vector{Module}; config...) :: Nothing
-assets_config!(package::Module; config...) :: Nothing

Utility function which allows bulk configuration of the assets.

Example

Genie.Assets.assets_config!([Genie, Stipple, StippleUI], host = "https://cdn.statically.io/gh/GenieFramework")
source
assets_config!(; config...) :: Nothing

Updates the assets configuration for the current package.

source
Missing docstring.

Missing docstring for assets_endpoint. Check Documenter's build log for details.

Genie.Assets.asset_fileFunction
asset_file(; cwd = "", file::String, path::String = "", type::String = "", prefix::String = "assets",
-              ext::String = "", min::Bool = false, skip_ext::Bool = false) :: String

Generates the file system path to an asset file.

source
Genie.Assets.asset_pathFunction
asset_path(; file::String, host::String = Genie.config.base_path, package::String = "", version::String = "",
+Stipple.DEPS[:qdraggabletree] = draggabletree_deps
source
Genie.Assets.AssetsConfigType
mutable struct AssetsConfig

Manages the assets configuration for the current package. Define your own instance of AssetsConfig if you want to add support for asset management for your package through Genie.Assets.

source
Genie.Assets.assets_config!Function
assets_config!(packages::Vector{Module}; config...) :: Nothing
+assets_config!(package::Module; config...) :: Nothing

Utility function which allows bulk configuration of the assets.

Example

Genie.Assets.assets_config!([Genie, Stipple, StippleUI], host = "https://cdn.statically.io/gh/GenieFramework")
source
assets_config!(; config...) :: Nothing

Updates the assets configuration for the current package.

source
Missing docstring.

Missing docstring for assets_endpoint. Check Documenter's build log for details.

Genie.Assets.asset_fileFunction
asset_file(; cwd = "", file::String, path::String = "", type::String = "", prefix::String = "assets",
+              ext::String = "", min::Bool = false, skip_ext::Bool = false) :: String

Generates the file system path to an asset file.

source
Genie.Assets.asset_pathFunction
asset_path(; file::String, host::String = Genie.config.base_path, package::String = "", version::String = "",
               prefix::String = "assets", type::String = "", path::String = "", min::Bool = false,
               ext::String = "", skip_ext::Bool = false, query::String = "") :: String
 asset_path(file::String; kwargs...) :: String
 asset_path(ac::AssetsConfig, tp::Union{Symbol,String}; type::String = string(tp), path::String = "",
-                file::String = "", ext::String = "", skip_ext::Bool = false, query::String = "") :: String

Generates the path to an asset file.

source
Genie.Assets.asset_routeFunction
asset_route(; file::String, package::String = "", version::String = "", prefix::String = "assets",
+                file::String = "", ext::String = "", skip_ext::Bool = false, query::String = "") :: String

Generates the path to an asset file.

source
Genie.Assets.asset_routeFunction
asset_route(; file::String, package::String = "", version::String = "", prefix::String = "assets",
               type::String = "", path::String = "", min::Bool = false,
               ext::String = "", skip_ext::Bool = false, query::String = "") :: String
 asset_route(file::String; kwargs...) :: String
 asset_route(ac::AssetsConfig, tp::Union{Symbol,String}; type::String = string(tp), path::String = "",
-            file::String = "", ext::String = "", skip_ext::Bool = false, query::String = "") :: String

Generates the route to an asset file.

source
Genie.Assets.channelsFunction
channels(channel::AbstractString = Genie.config.webchannels_default_route) :: String

Outputs the channels.js file included with the Genie package.

source
Missing docstring.

Missing docstring for channels_route. Check Documenter's build log for details.

Genie.Assets.channels_scriptFunction
channels_script(channel::AbstractString = Genie.config.webchannels_default_route) :: String

Outputs the channels JavaScript content within <script>...</script> tags, for embedding into the page.

source
Missing docstring.

Missing docstring for channels_script_tag. Check Documenter's build log for details.

Genie.Assets.channels_subscribeFunction
channels_subscribe(channel::AbstractString = Genie.config.webchannels_default_route) :: Nothing

Registers subscription and unsubscription channels for channel.

source
Genie.Assets.channels_supportFunction
channels_support(channel = Genie.config.webchannels_default_route) :: String

Provides full web channels support, setting up routes for loading support JS files, web sockets subscription and returning the <script> tag for including the linked JS file into the web page.

source
Genie.Assets.css_assetFunction
css_asset(file_name::String) :: String

Path to a css asset. The file_name should not include the extension.

source
Genie.Assets.embeddedFunction
embeded(path::String) :: String

Reads and outputs the file at path.

source
Genie.Assets.embedded_pathFunction
embeded_path(path::String) :: String

Returns the path relative to Genie's root package dir.

source
Genie.Assets.external_assetsFunction
external_assets(host::String) :: Bool
+            file::String = "", ext::String = "", skip_ext::Bool = false, query::String = "") :: String

Generates the route to an asset file.

source
Genie.Assets.channelsFunction
channels(channel::AbstractString = Genie.config.webchannels_default_route) :: String

Outputs the channels.js file included with the Genie package.

source
Missing docstring.

Missing docstring for channels_route. Check Documenter's build log for details.

Genie.Assets.channels_scriptFunction
channels_script(channel::AbstractString = Genie.config.webchannels_default_route) :: String

Outputs the channels JavaScript content within <script>...</script> tags, for embedding into the page.

source
Missing docstring.

Missing docstring for channels_script_tag. Check Documenter's build log for details.

Genie.Assets.channels_subscribeFunction
channels_subscribe(channel::AbstractString = Genie.config.webchannels_default_route) :: Nothing

Registers subscription and unsubscription channels for channel.

source
Genie.Assets.channels_supportFunction
channels_support(channel = Genie.config.webchannels_default_route) :: String

Provides full web channels support, setting up routes for loading support JS files, web sockets subscription and returning the <script> tag for including the linked JS file into the web page.

source
Genie.Assets.css_assetFunction
css_asset(file_name::String) :: String

Path to a css asset. The file_name should not include the extension.

source
Genie.Assets.embeddedFunction
embeded(path::String) :: String

Reads and outputs the file at path.

source
Genie.Assets.embedded_pathFunction
embeded_path(path::String) :: String

Returns the path relative to Genie's root package dir.

source
Genie.Assets.external_assetsFunction
external_assets(host::String) :: Bool
 external_assets(ac::AssetsConfig) :: Bool
-external_assets() :: Bool

Returns true if the current package is using external assets.

source
Genie.Assets.favicon_supportFunction
favicon_support() :: String

Outputs the <link> tag for referencing the favicon file embedded with Genie.

source
Genie.Assets.include_assetFunction
include_asset(asset_type::Union{String,Symbol}, file_name::Union{String,Symbol}) :: String

Returns the path to an asset. asset_type can be one of :js, :css. The file_name should not include the extension.

source
Genie.Assets.js_assetFunction
js_asset(file_name::String) :: String

Path to a js asset. file_name should not include the extension.

source
Missing docstring.

Missing docstring for jsliteral. Check Documenter's build log for details.

Genie.Assets.js_settingsFunction
js_settings(channel::String = Genie.config.webchannels_default_route) :: String

Sets up a window.Genie.Settings JavaScript object which exposes relevant Genie app settings from Genie.config

source
Genie.Assets.webthreadsFunction
webthreads() :: String

Outputs the webthreads.js file included with the Genie package

source
Missing docstring.

Missing docstring for webthreads_endpoint. Check Documenter's build log for details.

Genie.Assets.webthreads_push_pullFunction
function webthreads_push_pull(channel) :: Nothing

Registers push and pull routes for channel.

source
Missing docstring.

Missing docstring for webthreads_route. Check Documenter's build log for details.

Genie.Assets.webthreads_scriptFunction
webthreads_script() :: String

Outputs the channels JavaScript content within <script>...</script> tags, for embedding into the page.

source
Missing docstring.

Missing docstring for webthreads_script_tag. Check Documenter's build log for details.

Genie.Assets.webthreads_subscribeFunction
function webthreads_subscribe(channel) :: Nothing

Registers subscription and unsubscription routes for channel.

source
Genie.Assets.webthreads_supportFunction
webthreads_support(channel = Genie.config.webthreads_default_route) :: String

Provides full web channels support, setting up routes for loading support JS files, web sockets subscription and returning the <script> tag for including the linked JS file into the web page.

source
+external_assets() :: Bool

Returns true if the current package is using external assets.

source
Genie.Assets.favicon_supportFunction
favicon_support() :: String

Outputs the <link> tag for referencing the favicon file embedded with Genie.

source
Genie.Assets.include_assetFunction
include_asset(asset_type::Union{String,Symbol}, file_name::Union{String,Symbol}) :: String

Returns the path to an asset. asset_type can be one of :js, :css. The file_name should not include the extension.

source
Genie.Assets.js_assetFunction
js_asset(file_name::String) :: String

Path to a js asset. file_name should not include the extension.

source
Missing docstring.

Missing docstring for jsliteral. Check Documenter's build log for details.

Genie.Assets.js_settingsFunction
js_settings(channel::String = Genie.config.webchannels_default_route) :: String

Sets up a window.Genie.Settings JavaScript object which exposes relevant Genie app settings from Genie.config

source
Genie.Assets.webthreadsFunction
webthreads() :: String

Outputs the webthreads.js file included with the Genie package

source
Missing docstring.

Missing docstring for webthreads_endpoint. Check Documenter's build log for details.

Genie.Assets.webthreads_push_pullFunction
function webthreads_push_pull(channel) :: Nothing

Registers push and pull routes for channel.

source
Missing docstring.

Missing docstring for webthreads_route. Check Documenter's build log for details.

Genie.Assets.webthreads_scriptFunction
webthreads_script() :: String

Outputs the channels JavaScript content within <script>...</script> tags, for embedding into the page.

source
Missing docstring.

Missing docstring for webthreads_script_tag. Check Documenter's build log for details.

Genie.Assets.webthreads_subscribeFunction
function webthreads_subscribe(channel) :: Nothing

Registers subscription and unsubscription routes for channel.

source
Genie.Assets.webthreads_supportFunction
webthreads_support(channel = Genie.config.webthreads_default_route) :: String

Provides full web channels support, setting up routes for loading support JS files, web sockets subscription and returning the <script> tag for including the linked JS file into the web page.

source
diff --git a/dev/API/commands.html b/dev/API/commands.html index 9f46dd894..633189a07 100644 --- a/dev/API/commands.html +++ b/dev/API/commands.html @@ -1,2 +1,2 @@ -Commands · Genie - The Highly Productive Julia Web Framework
Genie.Commands.called_commandFunction
called_command(args::Dict, key::String) :: Bool

Checks whether or not a certain command was invoked by looking at the command line args.

source
Genie.Commands.executeFunction
execute(config::Settings) :: Nothing

Runs the requested Genie app command, based on the args passed to the script.

source
Genie.Commands.parse_commandline_argsFunction
parse_commandline_args() :: Dict{String,Any}

Extracts the command line args passed into the app and returns them as a Dict, possibly setting up defaults. Also, it is used by the ArgParse module to populate the command line help for the app -h.

source
+Commands · Genie - The Highly Productive Julia Web Framework
Genie.Commands.called_commandFunction
called_command(args::Dict, key::String) :: Bool

Checks whether or not a certain command was invoked by looking at the command line args.

source
Genie.Commands.executeFunction
execute(config::Settings) :: Nothing

Runs the requested Genie app command, based on the args passed to the script.

source
Genie.Commands.parse_commandline_argsFunction
parse_commandline_args() :: Dict{String,Any}

Extracts the command line args passed into the app and returns them as a Dict, possibly setting up defaults. Also, it is used by the ArgParse module to populate the command line help for the app -h.

source
diff --git a/dev/API/configuration.html b/dev/API/configuration.html index fa4eb3ce6..410962383 100644 --- a/dev/API/configuration.html +++ b/dev/API/configuration.html @@ -1,15 +1,15 @@ -Configuration · Genie - The Highly Productive Julia Web Framework
Genie.Configuration.isdevFunction
isdev()  :: Bool

Set of utility functions that return whether or not the current environment is development, production or testing.

Examples

julia> Configuration.isdev()
+Configuration · Genie - The Highly Productive Julia Web Framework
Genie.Configuration.isdevFunction
isdev()  :: Bool

Set of utility functions that return whether or not the current environment is development, production or testing.

Examples

julia> Configuration.isdev()
 true
 
 julia> Configuration.isprod()
-false
source
Genie.Configuration.isprodFunction
isprod() :: Bool

Set of utility functions that return whether or not the current environment is development, production or testing.

Examples

julia> Configuration.isdev()
+false
source
Genie.Configuration.isprodFunction
isprod() :: Bool

Set of utility functions that return whether or not the current environment is development, production or testing.

Examples

julia> Configuration.isdev()
 true
 
 julia> Configuration.isprod()
-false
source
Genie.Configuration.istestFunction
istest() :: Bool

Set of utility functions that return whether or not the current environment is development, production or testing.

Examples

julia> Configuration.isdev()
+false
source
Genie.Configuration.istestFunction
istest() :: Bool

Set of utility functions that return whether or not the current environment is development, production or testing.

Examples

julia> Configuration.isdev()
 true
 
 julia> Configuration.isprod()
-false
source
Genie.Configuration.SettingsType
mutable struct Settings

App configuration - sets up the app's defaults. Individual options are overwritten in the corresponding environment file.

Arguments

  • server_port::Int: the port for running the web server (default 8000)
  • server_host::String: the host for running the web server (default "127.0.0.1")
  • server_document_root::String: path to the document root (default "public/")
  • server_handle_static_files::Bool: if true, Genie will also serve static files. In production, it is recommended to serve static files with a web server like Nginx.
  • server_signature::String: Genie's signature used for tagging the HTTP responses. If empty, it will not be added.
  • app_env::String: the environment in which the app is running (dev, test, or prod)
  • cors_headers::Dict{String,String}: default Access-Control-* CORS settings
  • cors_allowed_origins::Vector{String}: allowed origin hosts for CORS settings
  • log_level::Logging.LogLevel: logging severity level
  • log_to_file::Bool: if true, information will be logged to file besides REPL
  • log_requests::Bool: if true, requests will be automatically logged
  • inflector_irregulars::Vector{Tuple{String,String}}: additional irregular singular-plural forms to be used by the Inflector
  • run_as_server::Bool: when true the server thread is launched synchronously to avoid that the script exits
  • websockets_server::Bool: if true, the websocket server is also started together with the web server
  • websockets_port::Int: the port for the websocket server (default server_port)
  • initializers_folder::String: the folder where the initializers are located (default "initializers/")
  • path_config::String: the path to the configurations folder (default "config/")
  • path_env::String: the path to the environment files (default "<path_config>/env/")
  • path_app::String: the path to the app files (default "app/")
  • html_parser_close_tag::String: default " /". Can be changed to an empty string "" so the single tags would not be closed.
  • webchannels_keepalive_frequency::Int: default 30000. Frequency in milliseconds to send keepalive messages to webchannel/websocket to keep the connection alive. Set to 0 to disable keepalive messages.
source
+false
source
Genie.Configuration.SettingsType
mutable struct Settings

App configuration - sets up the app's defaults. Individual options are overwritten in the corresponding environment file.

Arguments

  • server_port::Int: the port for running the web server (default 8000)
  • server_host::String: the host for running the web server (default "127.0.0.1")
  • server_document_root::String: path to the document root (default "public/")
  • server_handle_static_files::Bool: if true, Genie will also serve static files. In production, it is recommended to serve static files with a web server like Nginx.
  • server_signature::String: Genie's signature used for tagging the HTTP responses. If empty, it will not be added.
  • app_env::String: the environment in which the app is running (dev, test, or prod)
  • cors_headers::Dict{String,String}: default Access-Control-* CORS settings
  • cors_allowed_origins::Vector{String}: allowed origin hosts for CORS settings
  • log_level::Logging.LogLevel: logging severity level
  • log_to_file::Bool: if true, information will be logged to file besides REPL
  • log_requests::Bool: if true, requests will be automatically logged
  • inflector_irregulars::Vector{Tuple{String,String}}: additional irregular singular-plural forms to be used by the Inflector
  • run_as_server::Bool: when true the server thread is launched synchronously to avoid that the script exits
  • websockets_server::Bool: if true, the websocket server is also started together with the web server
  • websockets_port::Int: the port for the websocket server (default server_port)
  • initializers_folder::String: the folder where the initializers are located (default "initializers/")
  • path_config::String: the path to the configurations folder (default "config/")
  • path_env::String: the path to the environment files (default "<path_config>/env/")
  • path_app::String: the path to the app files (default "app/")
  • html_parser_close_tag::String: default " /". Can be changed to an empty string "" so the single tags would not be closed.
  • webchannels_keepalive_frequency::Int: default 30000. Frequency in milliseconds to send keepalive messages to webchannel/websocket to keep the connection alive. Set to 0 to disable keepalive messages.
source
diff --git a/dev/API/cookies.html b/dev/API/cookies.html index 3ed5d7fb7..0975ba228 100644 --- a/dev/API/cookies.html +++ b/dev/API/cookies.html @@ -5,4 +5,4 @@ "A" => 1

Alternatively, a sequence of pair arguments may be passed.

julia> Dict("A"=>1, "B"=>2)
 Dict{String, Int64} with 2 entries:
   "B" => 2
-  "A" => 1
source
Genie.Cookies.getFunction
get(payload::Union{HTTP.Response,HTTP.Request}, key::Union{String,Symbol}, default::T; encrypted::Bool = true)::T where T

Attempts to get the Cookie value stored at key within payload. If the key is not set, the default value is returned.

Arguments

  • payload::Union{HTTP.Response,HTTP.Request}: the request or response object containing the Cookie headers
  • key::Union{String,Symbol}: the name of the cookie value
  • default::T: default value to be returned if no cookie value is set at key
  • encrypted::Bool: if true the value stored on the cookie is automatically decrypted
source
get(res::HTTP.Response, key::Union{String,Symbol}) :: Union{Nothing,String}

Retrieves a value stored on the cookie as key from the Respose object.

Arguments

  • payload::Union{HTTP.Response,HTTP.Request}: the request or response object containing the Cookie headers
  • key::Union{String,Symbol}: the name of the cookie value
  • encrypted::Bool: if true the value stored on the cookie is automatically decrypted
source
get(req::Request, key::Union{String,Symbol}) :: Union{Nothing,String}

Retrieves a value stored on the cookie as key from the Request object.

Arguments

  • req::HTTP.Request: the request or response object containing the Cookie headers
  • key::Union{String,Symbol}: the name of the cookie value
  • encrypted::Bool: if true the value stored on the cookie is automatically decrypted
source
Genie.Cookies.getcookiesFunction
getcookies(req::HTTP.Request) :: Vector{HTTP.Cookies.Cookie}

Extracts cookies from within req

source
getcookies(req::HTTP.Request) :: Vector{HTTP.Cookies.Cookie}

Extracts cookies from within req, filtering them by matching name.

source
Genie.Cookies.set!Function
set!(res::HTTP.Response, key::Union{String,Symbol}, value::Any, attributes::Dict; encrypted::Bool = true) :: HTTP.Response

Sets value under the key label on the Cookie.

Arguments

  • res::HTTP.Response: the HTTP.Response object
  • key::Union{String,Symbol}: the key for storing the cookie value
  • value::Any: the cookie value
  • attributes::Dict: additional cookie attributes, such as path, httponly, maxage
  • encrypted::Bool: if true the value is stored encoded
source
Genie.Cookies.nullablevalueFunction
nullablevalue(payload::Union{HTTP.Response,HTTP.Request}, key::Union{String,Symbol}; encrypted::Bool = true)

Attempts to retrieve a cookie value stored at key in the payload object and returns a Union{Nothing,String}

Arguments

  • payload::Union{HTTP.Response,HTTP.Request}: the request or response object containing the Cookie headers
  • key::Union{String,Symbol}: the name of the cookie value
  • encrypted::Bool: if true the value stored on the cookie is automatically decrypted
source
+ "A" => 1source
Genie.Cookies.getFunction
get(payload::Union{HTTP.Response,HTTP.Request}, key::Union{String,Symbol}, default::T; encrypted::Bool = true)::T where T

Attempts to get the Cookie value stored at key within payload. If the key is not set, the default value is returned.

Arguments

  • payload::Union{HTTP.Response,HTTP.Request}: the request or response object containing the Cookie headers
  • key::Union{String,Symbol}: the name of the cookie value
  • default::T: default value to be returned if no cookie value is set at key
  • encrypted::Bool: if true the value stored on the cookie is automatically decrypted
source
get(res::HTTP.Response, key::Union{String,Symbol}) :: Union{Nothing,String}

Retrieves a value stored on the cookie as key from the Respose object.

Arguments

  • payload::Union{HTTP.Response,HTTP.Request}: the request or response object containing the Cookie headers
  • key::Union{String,Symbol}: the name of the cookie value
  • encrypted::Bool: if true the value stored on the cookie is automatically decrypted
source
get(req::Request, key::Union{String,Symbol}) :: Union{Nothing,String}

Retrieves a value stored on the cookie as key from the Request object.

Arguments

  • req::HTTP.Request: the request or response object containing the Cookie headers
  • key::Union{String,Symbol}: the name of the cookie value
  • encrypted::Bool: if true the value stored on the cookie is automatically decrypted
source
Genie.Cookies.getcookiesFunction
getcookies(req::HTTP.Request) :: Vector{HTTP.Cookies.Cookie}

Extracts cookies from within req

source
getcookies(req::HTTP.Request) :: Vector{HTTP.Cookies.Cookie}

Extracts cookies from within req, filtering them by matching name.

source
Genie.Cookies.set!Function
set!(res::HTTP.Response, key::Union{String,Symbol}, value::Any, attributes::Dict; encrypted::Bool = true) :: HTTP.Response

Sets value under the key label on the Cookie.

Arguments

  • res::HTTP.Response: the HTTP.Response object
  • key::Union{String,Symbol}: the key for storing the cookie value
  • value::Any: the cookie value
  • attributes::Dict: additional cookie attributes, such as path, httponly, maxage
  • encrypted::Bool: if true the value is stored encoded
source
Genie.Cookies.nullablevalueFunction
nullablevalue(payload::Union{HTTP.Response,HTTP.Request}, key::Union{String,Symbol}; encrypted::Bool = true)

Attempts to retrieve a cookie value stored at key in the payload object and returns a Union{Nothing,String}

Arguments

  • payload::Union{HTTP.Response,HTTP.Request}: the request or response object containing the Cookie headers
  • key::Union{String,Symbol}: the name of the cookie value
  • encrypted::Bool: if true the value stored on the cookie is automatically decrypted
source
diff --git a/dev/API/encryption.html b/dev/API/encryption.html index 5c8663255..aa71c1073 100644 --- a/dev/API/encryption.html +++ b/dev/API/encryption.html @@ -1,2 +1,2 @@ -Encryption · Genie - The Highly Productive Julia Web Framework
+Encryption · Genie - The Highly Productive Julia Web Framework
diff --git a/dev/API/exceptions.html b/dev/API/exceptions.html index 20e1adf85..d0a61ceba 100644 --- a/dev/API/exceptions.html +++ b/dev/API/exceptions.html @@ -1,2 +1,2 @@ -Exceptions · Genie - The Highly Productive Julia Web Framework
Genie.Exceptions.ExceptionalResponseType
struct ExceptionalResponse <: Exception

A type of exception which wraps an HTTP Response object. The thrown exception will propagate until it is caught up the app stack or ultimately by Genie and the wrapped response is sent to the client.

Example

If the user is not authenticated, an ExceptionalResponse is thrown - if the exception is not caught in the app's stack, Genie will catch it and return the wrapped Response object, forcing an HTTP redirect to the login page.

isauthenticated() || throw(ExceptionalResponse(redirect(:show_login)))
source
Genie.Exceptions.InternalServerExceptionType
struct InternalServerException <: Exception

Dedicated exception type for server side exceptions. Results in a 500 error by default.

Arguments

  • message::String
  • info::String
  • code::Int
source
Genie.Exceptions.NotFoundExceptionType
struct NotFoundException <: Exception

Specialized exception representing a not found resources. Results in a 404 response being sent to the client.

Arguments

  • message::String
  • info::String
  • code::Int
  • resource::String
source
Genie.Exceptions.RuntimeExceptionType
RuntimeException

Represents an unexpected and unhandled runtime exceptions. An error event will be logged and the exception will be sent to the client, depending on the environment (the error stack is dumped by default in dev mode or an error message is displayed in production).

It allows defining custom error message and info, as well as an error code, in addition to the exception object.

Arguments

  • message::String
  • info::String
  • code::Int
  • ex::Union{Nothing,Exception}
source
+Exceptions · Genie - The Highly Productive Julia Web Framework
Genie.Exceptions.ExceptionalResponseType
struct ExceptionalResponse <: Exception

A type of exception which wraps an HTTP Response object. The thrown exception will propagate until it is caught up the app stack or ultimately by Genie and the wrapped response is sent to the client.

Example

If the user is not authenticated, an ExceptionalResponse is thrown - if the exception is not caught in the app's stack, Genie will catch it and return the wrapped Response object, forcing an HTTP redirect to the login page.

isauthenticated() || throw(ExceptionalResponse(redirect(:show_login)))
source
Genie.Exceptions.InternalServerExceptionType
struct InternalServerException <: Exception

Dedicated exception type for server side exceptions. Results in a 500 error by default.

Arguments

  • message::String
  • info::String
  • code::Int
source
Genie.Exceptions.NotFoundExceptionType
struct NotFoundException <: Exception

Specialized exception representing a not found resources. Results in a 404 response being sent to the client.

Arguments

  • message::String
  • info::String
  • code::Int
  • resource::String
source
Genie.Exceptions.RuntimeExceptionType
RuntimeException

Represents an unexpected and unhandled runtime exceptions. An error event will be logged and the exception will be sent to the client, depending on the environment (the error stack is dumped by default in dev mode or an error message is displayed in production).

It allows defining custom error message and info, as well as an error code, in addition to the exception object.

Arguments

  • message::String
  • info::String
  • code::Int
  • ex::Union{Nothing,Exception}
source
diff --git a/dev/API/filetemplates.html b/dev/API/filetemplates.html index 4c5b3cfe2..eee738c20 100644 --- a/dev/API/filetemplates.html +++ b/dev/API/filetemplates.html @@ -1,2 +1,2 @@ -FileTemplates · Genie - The Highly Productive Julia Web Framework
+FileTemplates · Genie - The Highly Productive Julia Web Framework
diff --git a/dev/API/generator.html b/dev/API/generator.html index be7af788a..6ae4d620f 100644 --- a/dev/API/generator.html +++ b/dev/API/generator.html @@ -1,5 +1,5 @@ -Generator · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for autoconfdb. Check Documenter's build log for details.

Genie.Generator.autostart_appFunction
autostart_app(path::String = "."; autostart::Bool = true) :: Nothing

If autostart is true, the newly generated Genie app will be automatically started.

source
Missing docstring.

Missing docstring for binfolderpath. Check Documenter's build log for details.

Missing docstring.

Missing docstring for db_intializer. Check Documenter's build log for details.

Genie.Generator.generate_projectFunction
generate_project(name)

Generate the Project.toml with a name and a uuid. If this file already exists, generate Project_sample.toml as a reference instead.

source
Missing docstring.

Missing docstring for install_db_dependencies. Check Documenter's build log for details.

Missing docstring.

Missing docstring for install_searchlight_dependencies. Check Documenter's build log for details.

Genie.Generator.minimalFunction
minimal(app_name::String, app_path::String = abspath(app_name), autostart::Bool = true) :: Nothing

Creates a minimal Genie app.

source
Genie.Generator.mvc_supportFunction
mvc_support(app_path::String = ".") :: Nothing

Writes the files used for rendering resources using the MVC stack and the Genie templating system.

source
Genie.Generator.newappFunction
newapp(app_name::String; autostart::Bool = true, fullstack::Bool = false, dbsupport::Bool = false, mvcsupport::Bool = false) :: Nothing

Scaffolds a new Genie app, setting up the file structure indicated by the various arguments.

Arguments

  • app_name::String: the name of the app (can be the full path where the app should be created).
  • autostart::Bool: automatically start the app once the file structure is created
  • fullstack::Bool: the type of app to be bootstrapped. The fullstack app includes MVC structure, DB connection code, and asset pipeline files.
  • dbsupport::Bool: bootstrap the files needed for DB connection setup via the SearchLight ORM
  • mvcsupport::Bool: adds the files used for HTML+Julia view templates rendering and working with resources
  • dbadapter::Union{String,Symbol,Nothing} = nothing : pass the SearchLight database adapter to be used by default

(one of :MySQL, :SQLite, or :PostgreSQL). If dbadapter is nothing, an adapter will have to be selected interactivel at the REPL, during the app creation process.

Examples

julia> Genie.Generator.newapp("MyGenieApp")
+Generator · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for autoconfdb. Check Documenter's build log for details.

Genie.Generator.autostart_appFunction
autostart_app(path::String = "."; autostart::Bool = true) :: Nothing

If autostart is true, the newly generated Genie app will be automatically started.

source
Missing docstring.

Missing docstring for binfolderpath. Check Documenter's build log for details.

Missing docstring.

Missing docstring for db_intializer. Check Documenter's build log for details.

Genie.Generator.generate_projectFunction
generate_project(name)

Generate the Project.toml with a name and a uuid. If this file already exists, generate Project_sample.toml as a reference instead.

source
Missing docstring.

Missing docstring for install_db_dependencies. Check Documenter's build log for details.

Missing docstring.

Missing docstring for install_searchlight_dependencies. Check Documenter's build log for details.

Genie.Generator.minimalFunction
minimal(app_name::String, app_path::String = abspath(app_name), autostart::Bool = true) :: Nothing

Creates a minimal Genie app.

source
Genie.Generator.mvc_supportFunction
mvc_support(app_path::String = ".") :: Nothing

Writes the files used for rendering resources using the MVC stack and the Genie templating system.

source
Genie.Generator.newappFunction
newapp(app_name::String; autostart::Bool = true, fullstack::Bool = false, dbsupport::Bool = false, mvcsupport::Bool = false) :: Nothing

Scaffolds a new Genie app, setting up the file structure indicated by the various arguments.

Arguments

  • app_name::String: the name of the app (can be the full path where the app should be created).
  • autostart::Bool: automatically start the app once the file structure is created
  • fullstack::Bool: the type of app to be bootstrapped. The fullstack app includes MVC structure, DB connection code, and asset pipeline files.
  • dbsupport::Bool: bootstrap the files needed for DB connection setup via the SearchLight ORM
  • mvcsupport::Bool: adds the files used for HTML+Julia view templates rendering and working with resources
  • dbadapter::Union{String,Symbol,Nothing} = nothing : pass the SearchLight database adapter to be used by default

(one of :MySQL, :SQLite, or :PostgreSQL). If dbadapter is nothing, an adapter will have to be selected interactivel at the REPL, during the app creation process.

Examples

julia> Genie.Generator.newapp("MyGenieApp")
 2019-08-06 16:54:15:INFO:Main: Done! New app created at MyGenieApp
 2019-08-06 16:54:15:DEBUG:Main: Changing active directory to MyGenieApp
 2019-08-06 16:54:15:DEBUG:Main: Installing app dependencies
@@ -20,4 +20,4 @@
 [ Info: Logging to file at MyGenieApp/log/dev.log
 [ Info: Ready!
 2019-08-06 16:54:32:DEBUG:Main: Web Server starting at http://127.0.0.1:8000
-2019-08-06 16:54:32:DEBUG:Main: Web Server running at http://127.0.0.1:8000
source
Genie.Generator.newapp_fullstackFunction
newapp_fullstack(name::String; autostart::Bool = true) :: Nothing

Template for scaffolding a new Genie app suitable for full stack web applications (includes MVC structure, DB support, and frontend asset pipeline).

Arguments

  • name::String: the name of the app
  • autostart::Bool: automatically start the app once the file structure is created
  • dbadapter::Union{String,Symbol,Nothing} = nothing : pass the SearchLight database adapter to be used by default

(one of :MySQL, :SQLite, or :PostgreSQL). If dbadapter is nothing, an adapter will have to be selected interactivel at the REPL, during the app creation process.

source
Genie.Generator.newapp_mvcFunction
newapp_mvc(name::String; autostart::Bool = true) :: Nothing

Template for scaffolding a new Genie app suitable for MVC web applications (includes MVC structure and DB support).

Arguments

  • name::String: the name of the app
  • autostart::Bool: automatically start the app once the file structure is created
  • dbadapter::Union{String,Symbol,Nothing} = nothing : pass the SearchLight database adapter to be used by default

(one of :MySQL, :SQLite, or :PostgreSQL). If dbadapter is nothing, an adapter will have to be selected interactivel at the REPL, during the app creation process.

source
Genie.Generator.newapp_webserviceFunction
newapp_webservice(name::String; autostart::Bool = true, dbsupport::Bool = false) :: Nothing

Template for scaffolding a new Genie app suitable for nimble web services.

Arguments

  • name::String: the name of the app
  • autostart::Bool: automatically start the app once the file structure is created
  • dbsupport::Bool: bootstrap the files needed for DB connection setup via the SearchLight ORM
  • dbadapter::Union{String,Symbol,Nothing} = nothing : pass the SearchLight database adapter to be used by default

(one of :MySQL, :SQLite, or :PostgreSQL). If dbadapter is nothing, an adapter will have to be selected interactivel at the REPL, during the app creation process.

source
Genie.Generator.newcontrollerFunction
newcontroller(controller_name::Union{String,Symbol}) :: Nothing

Creates a new controller file. If pluralize is false, the name of the controller is not automatically pluralized.

source
newcontroller(resource_name::String) :: Nothing

Generates a new Genie controller file and persists it to the resources folder.

source
Genie.Generator.newresourceFunction
newresource(resource_name::Union{String,Symbol}; pluralize::Bool = true, context::Union{Module,Nothing} = nothing) :: Nothing

Creates all the files associated with a new resource. If pluralize is false, the name of the resource is not automatically pluralized.

source
newresource(resource_name::String, config::Settings) :: Nothing

Generates all the files associated with a new resource and persists them to the resources folder.

source
Missing docstring.

Missing docstring for pkggenfile. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pkgproject. Check Documenter's build log for details.

Missing docstring.

Missing docstring for post_create. Check Documenter's build log for details.

Genie.Generator.scaffoldFunction
scaffold(app_name::String, app_path::String = "") :: Nothing

Writes the file necessary to scaffold a minimal Genie app.

source
Missing docstring.

Missing docstring for set_files_mod. Check Documenter's build log for details.

Missing docstring.

Missing docstring for validname. Check Documenter's build log for details.

Missing docstring.

Missing docstring for write_db_config. Check Documenter's build log for details.

+2019-08-06 16:54:32:DEBUG:Main: Web Server running at http://127.0.0.1:8000
source
Genie.Generator.newapp_fullstackFunction
newapp_fullstack(name::String; autostart::Bool = true) :: Nothing

Template for scaffolding a new Genie app suitable for full stack web applications (includes MVC structure, DB support, and frontend asset pipeline).

Arguments

  • name::String: the name of the app
  • autostart::Bool: automatically start the app once the file structure is created
  • dbadapter::Union{String,Symbol,Nothing} = nothing : pass the SearchLight database adapter to be used by default

(one of :MySQL, :SQLite, or :PostgreSQL). If dbadapter is nothing, an adapter will have to be selected interactivel at the REPL, during the app creation process.

source
Genie.Generator.newapp_mvcFunction
newapp_mvc(name::String; autostart::Bool = true) :: Nothing

Template for scaffolding a new Genie app suitable for MVC web applications (includes MVC structure and DB support).

Arguments

  • name::String: the name of the app
  • autostart::Bool: automatically start the app once the file structure is created
  • dbadapter::Union{String,Symbol,Nothing} = nothing : pass the SearchLight database adapter to be used by default

(one of :MySQL, :SQLite, or :PostgreSQL). If dbadapter is nothing, an adapter will have to be selected interactivel at the REPL, during the app creation process.

source
Genie.Generator.newapp_webserviceFunction
newapp_webservice(name::String; autostart::Bool = true, dbsupport::Bool = false) :: Nothing

Template for scaffolding a new Genie app suitable for nimble web services.

Arguments

  • name::String: the name of the app
  • autostart::Bool: automatically start the app once the file structure is created
  • dbsupport::Bool: bootstrap the files needed for DB connection setup via the SearchLight ORM
  • dbadapter::Union{String,Symbol,Nothing} = nothing : pass the SearchLight database adapter to be used by default

(one of :MySQL, :SQLite, or :PostgreSQL). If dbadapter is nothing, an adapter will have to be selected interactivel at the REPL, during the app creation process.

source
Genie.Generator.newcontrollerFunction
newcontroller(controller_name::Union{String,Symbol}) :: Nothing

Creates a new controller file. If pluralize is false, the name of the controller is not automatically pluralized.

source
newcontroller(resource_name::String) :: Nothing

Generates a new Genie controller file and persists it to the resources folder.

source
Genie.Generator.newresourceFunction
newresource(resource_name::Union{String,Symbol}; pluralize::Bool = true, context::Union{Module,Nothing} = nothing) :: Nothing

Creates all the files associated with a new resource. If pluralize is false, the name of the resource is not automatically pluralized.

source
newresource(resource_name::String, config::Settings) :: Nothing

Generates all the files associated with a new resource and persists them to the resources folder.

source
Missing docstring.

Missing docstring for pkggenfile. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pkgproject. Check Documenter's build log for details.

Missing docstring.

Missing docstring for post_create. Check Documenter's build log for details.

Genie.Generator.scaffoldFunction
scaffold(app_name::String, app_path::String = "") :: Nothing

Writes the file necessary to scaffold a minimal Genie app.

source
Missing docstring.

Missing docstring for set_files_mod. Check Documenter's build log for details.

Missing docstring.

Missing docstring for validname. Check Documenter's build log for details.

Missing docstring.

Missing docstring for write_db_config. Check Documenter's build log for details.

diff --git a/dev/API/genie.html b/dev/API/genie.html index e3d1063b3..04733fe9d 100644 --- a/dev/API/genie.html +++ b/dev/API/genie.html @@ -1,5 +1,5 @@ -Genie · Genie - The Highly Productive Julia Web Framework
Genie.downFunction
down(; webserver::Bool = true, websockets::Bool = true) :: ServersCollection

Shuts down the servers optionally indicating which of the webserver and websockets servers to be stopped. It does not remove the servers from the SERVERS collection. Returns the collection.

source
Genie.down!Function
function down!(; webserver::Bool = true, websockets::Bool = true) :: Vector{ServersCollection}

Shuts down all the servers and empties the SERVERS collection. Returns the empty collection.

source
Genie.goFunction
loadapp(path::String = "."; autostart::Bool = false) :: Nothing

Loads an existing Genie app from the file system, within the current Julia REPL session.

Arguments

  • path::String: the path to the Genie app on the file system.
  • autostart::Bool: automatically start the app upon loading it.

Examples

shell> tree -L 1
+Genie · Genie - The Highly Productive Julia Web Framework
Genie.downFunction
down(; webserver::Bool = true, websockets::Bool = true) :: ServersCollection

Shuts down the servers optionally indicating which of the webserver and websockets servers to be stopped. It does not remove the servers from the SERVERS collection. Returns the collection.

source
Genie.down!Function
function down!(; webserver::Bool = true, websockets::Bool = true) :: Vector{ServersCollection}

Shuts down all the servers and empties the SERVERS collection. Returns the empty collection.

source
Genie.goFunction
loadapp(path::String = "."; autostart::Bool = false) :: Nothing

Loads an existing Genie app from the file system, within the current Julia REPL session.

Arguments

  • path::String: the path to the Genie app on the file system.
  • autostart::Bool: automatically start the app upon loading it.

Examples

shell> tree -L 1
 .
 ├── Manifest.toml
 ├── Project.toml
@@ -26,7 +26,7 @@
 ┌ Info:
 │ Starting Genie in >> DEV << mode
 └
-[ Info: Logging to file at MyGenieApp/log/dev.log
source
Missing docstring.

Missing docstring for isrunning. Check Documenter's build log for details.

Genie.loadappFunction
loadapp(path::String = "."; autostart::Bool = false) :: Nothing

Loads an existing Genie app from the file system, within the current Julia REPL session.

Arguments

  • path::String: the path to the Genie app on the file system.
  • autostart::Bool: automatically start the app upon loading it.

Examples

shell> tree -L 1
+[ Info: Logging to file at MyGenieApp/log/dev.log
source
Missing docstring.

Missing docstring for isrunning. Check Documenter's build log for details.

Genie.loadappFunction
loadapp(path::String = "."; autostart::Bool = false) :: Nothing

Loads an existing Genie app from the file system, within the current Julia REPL session.

Arguments

  • path::String: the path to the Genie app on the file system.
  • autostart::Bool: automatically start the app upon loading it.

Examples

shell> tree -L 1
 .
 ├── Manifest.toml
 ├── Project.toml
@@ -53,7 +53,7 @@
 ┌ Info:
 │ Starting Genie in >> DEV << mode
 └
-[ Info: Logging to file at MyGenieApp/log/dev.log
source
Genie.runFunction
run() :: Nothing

Runs the Genie app by parsing the command line args and invoking the corresponding actions. Used internally to parse command line arguments.

source
Genie.upFunction
up(port::Int = Genie.config.server_port, host::String = Genie.config.server_host;
+[ Info: Logging to file at MyGenieApp/log/dev.log
source
Genie.runFunction
run() :: Nothing

Runs the Genie app by parsing the command line args and invoking the corresponding actions. Used internally to parse command line arguments.

source
Genie.upFunction
up(port::Int = Genie.config.server_port, host::String = Genie.config.server_host;
     ws_port::Int = Genie.config.websockets_port, async::Bool = ! Genie.config.run_as_server) :: Nothing

Starts the web server. Alias for Server.up

Arguments

  • port::Int: the port used by the web server
  • host::String: the host used by the web server
  • ws_port::Int: the port used by the Web Sockets server
  • async::Bool: run the web server task asynchronously

Examples

julia> up(8000, "127.0.0.1", async = false)
 [ Info: Ready!
-Web Server starting at http://127.0.0.1:8000
source
+Web Server starting at http://127.0.0.1:8000
source
diff --git a/dev/API/headers.html b/dev/API/headers.html index 8aa9eb9da..d1a5887be 100644 --- a/dev/API/headers.html +++ b/dev/API/headers.html @@ -1,2 +1,2 @@ -Headers · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for set_access_control_allow_headers!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for set_access_control_allow_origin!. Check Documenter's build log for details.

Genie.Headers.set_headers!Function
set_headers!(req::HTTP.Request, res::HTTP.Response, app_response::HTTP.Response) :: HTTP.Response

Configures the response headers.

source
+Headers · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for set_access_control_allow_headers!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for set_access_control_allow_origin!. Check Documenter's build log for details.

Genie.Headers.set_headers!Function
set_headers!(req::HTTP.Request, res::HTTP.Response, app_response::HTTP.Response) :: HTTP.Response

Configures the response headers.

source
diff --git a/dev/API/httputils.html b/dev/API/httputils.html index cb765913b..5d661e16b 100644 --- a/dev/API/httputils.html +++ b/dev/API/httputils.html @@ -1,2 +1,2 @@ -HttpUtils · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for HTTPUtils.Dict. Check Documenter's build log for details.

+HttpUtils · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for HTTPUtils.Dict. Check Documenter's build log for details.

diff --git a/dev/API/index.html b/dev/API/index.html index 389d90213..41600530f 100644 --- a/dev/API/index.html +++ b/dev/API/index.html @@ -1,2 +1,2 @@ -Genie · Genie - The Highly Productive Julia Web Framework

Genie Logo

Genie

The highly productive Julia web framework

Genie is Julia web framework that provides a streamlined and efficient workflow for developing modern web applications. It builds on Julia's strengths (high-level, high-performance, dynamic, JIT compiled), exposing a rich API and a powerful toolset for productive web development.

Current status

Genie is compatible with Julia v1.3 and up.


Acknowledgements

  • Genie uses a multitude of packages that have been kindly contributed by the Julia community.
  • The awesome Genie logo was designed by Alvaro Casanova.
+Genie · Genie - The Highly Productive Julia Web Framework

Genie Logo

Genie

The highly productive Julia web framework

Genie is Julia web framework that provides a streamlined and efficient workflow for developing modern web applications. It builds on Julia's strengths (high-level, high-performance, dynamic, JIT compiled), exposing a rich API and a powerful toolset for productive web development.

Current status

Genie is compatible with Julia v1.3 and up.


Acknowledgements

  • Genie uses a multitude of packages that have been kindly contributed by the Julia community.
  • The awesome Genie logo was designed by Alvaro Casanova.
diff --git a/dev/API/input.html b/dev/API/input.html index 2d7e75839..e6fca6a3b 100644 --- a/dev/API/input.html +++ b/dev/API/input.html @@ -1,2 +1,2 @@ -Input · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for HttpFormPart. Check Documenter's build log for details.

Missing docstring.

Missing docstring for HttpInput. Check Documenter's build log for details.

Missing docstring.

Missing docstring for all. Check Documenter's build log for details.

Missing docstring.

Missing docstring for files. Check Documenter's build log for details.

Missing docstring.

Missing docstring for get_multiform_parts!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for parse_seicolon_fields. Check Documenter's build log for details.

Missing docstring.

Missing docstring for post. Check Documenter's build log for details.

Missing docstring.

Missing docstring for post_from_request!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for parse_quoted_params. Check Documenter's build log for details.

Missing docstring.

Missing docstring for post_multipart!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for post_url_encoded!. Check Documenter's build log for details.

+Input · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for HttpFormPart. Check Documenter's build log for details.

Missing docstring.

Missing docstring for HttpInput. Check Documenter's build log for details.

Missing docstring.

Missing docstring for all. Check Documenter's build log for details.

Missing docstring.

Missing docstring for files. Check Documenter's build log for details.

Missing docstring.

Missing docstring for get_multiform_parts!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for parse_seicolon_fields. Check Documenter's build log for details.

Missing docstring.

Missing docstring for post. Check Documenter's build log for details.

Missing docstring.

Missing docstring for post_from_request!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for parse_quoted_params. Check Documenter's build log for details.

Missing docstring.

Missing docstring for post_multipart!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for post_url_encoded!. Check Documenter's build log for details.

diff --git a/dev/API/loader.html b/dev/API/loader.html index ae9bbc063..e7224f658 100644 --- a/dev/API/loader.html +++ b/dev/API/loader.html @@ -1,2 +1,2 @@ -Loader · Genie - The Highly Productive Julia Web Framework
Genie.Loader.autoloadFunction
autoload

Automatically and recursively includes files from the indicated root_dir into the indicated context module, skipping directories from dir. The files are set up with Revise to be automatically reloaded when changed (in dev environment).

source
Genie.Loader.bootstrapFunction
bootstrap(context::Union{Module,Nothing} = nothing) :: Nothing

Kickstarts the loading of a Genie app by loading the environment settings.

source
Missing docstring.

Missing docstring for importenv. Check Documenter's build log for details.

Genie.Loader.loadFunction
load(; context::Union{Module,Nothing} = nothing) :: Nothing

Main entry point to loading a Genie app.

source
Genie.Loader.load_helpersFunction
load_helpers(root_dir::String = Genie.config.path_helpers) :: Nothing

Automatically recursively includes files from helpers/ and subfolders.

source
Genie.Loader.load_initializersFunction
load_initializers(root_dir::String = Genie.config.path_config; context::Union{Module,Nothing} = nothing) :: Nothing

Automatically recursively includes files from initializers/ and subfolders.

source
Genie.Loader.load_libsFunction
load_libs(root_dir::String = Genie.config.path_lib) :: Nothing

Recursively includes files from lib/ and subfolders. The lib/ folder, if present, is designed to host user code in the form of .jl files.

source
Genie.Loader.load_pluginsFunction
load_plugins(root_dir::String = Genie.config.path_plugins; context::Union{Module,Nothing} = nothing) :: Nothing

Automatically recursively includes files from plugins/ and subfolders.

source
Genie.Loader.load_resourcesFunction
load_resources(root_dir::String = Genie.config.path_resources) :: Nothing

Automatically recursively includes files from resources/ and subfolders.

source
Genie.Loader.load_routesFunction
load_routes(routes_file::String = Genie.ROUTES_FILE_NAME; context::Union{Module,Nothing} = nothing) :: Nothing

Loads the routes file.

source
+Loader · Genie - The Highly Productive Julia Web Framework
Genie.Loader.autoloadFunction
autoload

Automatically and recursively includes files from the indicated root_dir into the indicated context module, skipping directories from dir. The files are set up with Revise to be automatically reloaded when changed (in dev environment).

source
Genie.Loader.bootstrapFunction
bootstrap(context::Union{Module,Nothing} = nothing) :: Nothing

Kickstarts the loading of a Genie app by loading the environment settings.

source
Missing docstring.

Missing docstring for importenv. Check Documenter's build log for details.

Genie.Loader.loadFunction
load(; context::Union{Module,Nothing} = nothing) :: Nothing

Main entry point to loading a Genie app.

source
Genie.Loader.load_helpersFunction
load_helpers(root_dir::String = Genie.config.path_helpers) :: Nothing

Automatically recursively includes files from helpers/ and subfolders.

source
Genie.Loader.load_initializersFunction
load_initializers(root_dir::String = Genie.config.path_config; context::Union{Module,Nothing} = nothing) :: Nothing

Automatically recursively includes files from initializers/ and subfolders.

source
Genie.Loader.load_libsFunction
load_libs(root_dir::String = Genie.config.path_lib) :: Nothing

Recursively includes files from lib/ and subfolders. The lib/ folder, if present, is designed to host user code in the form of .jl files.

source
Genie.Loader.load_pluginsFunction
load_plugins(root_dir::String = Genie.config.path_plugins; context::Union{Module,Nothing} = nothing) :: Nothing

Automatically recursively includes files from plugins/ and subfolders.

source
Genie.Loader.load_resourcesFunction
load_resources(root_dir::String = Genie.config.path_resources) :: Nothing

Automatically recursively includes files from resources/ and subfolders.

source
Genie.Loader.load_routesFunction
load_routes(routes_file::String = Genie.ROUTES_FILE_NAME; context::Union{Module,Nothing} = nothing) :: Nothing

Loads the routes file.

source
diff --git a/dev/API/logger.html b/dev/API/logger.html index d83c08ab1..7448f3be9 100644 --- a/dev/API/logger.html +++ b/dev/API/logger.html @@ -1,2 +1,2 @@ -Logger · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for initialize_logging. Check Documenter's build log for details.

Missing docstring.

Missing docstring for timestamp_logger. Check Documenter's build log for details.

+Logger · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for initialize_logging. Check Documenter's build log for details.

Missing docstring.

Missing docstring for timestamp_logger. Check Documenter's build log for details.

diff --git a/dev/API/renderer-html.html b/dev/API/renderer-html.html index 8ad9f5af8..91d5ff37c 100644 --- a/dev/API/renderer-html.html +++ b/dev/API/renderer-html.html @@ -1,11 +1,11 @@ -HTML Renderer · Genie - The Highly Productive Julia Web Framework
Genie.Renderer.Html.normal_elementFunction
normal_element(f::Function, elem::String, attrs::Vector{Pair{Symbol,Any}} = Pair{Symbol,Any}[]) :: HTMLString

Generates a HTML element in the form <...></...>

source
Genie.Renderer.Html.void_elementFunction
void_element(elem::String, attrs::Vector{Pair{Symbol,String}} = Vector{Pair{Symbol,String}}()) :: HTMLString

Generates a void HTML element in the form <...>

source
Missing docstring.

Missing docstring for skip_element. Check Documenter's build log for details.

Missing docstring.

Missing docstring for include_markdown. Check Documenter's build log for details.

Genie.Renderer.Html.get_templateFunction
get_template(path::String; partial::Bool = true, context::Module = @__MODULE__, vars...) :: Function

Resolves the inclusion and rendering of a template file

source
Genie.Renderer.Html.parseviewFunction
parseview(data::String; partial = false, context::Module = @__MODULE__) :: Function

Parses a view file, returning a rendering function. If necessary, the function is JIT-compiled, persisted and loaded into memory.

source
Genie.Renderer.Html.renderFunction
render(data::String; context::Module = @__MODULE__, layout::Union{String,Nothing} = nothing, vars...) :: Function

Renders the string as an HTML view.

source
render(viewfile::Genie.Renderer.FilePath; layout::Union{Nothing,Genie.Renderer.FilePath} = nothing, context::Module = @__MODULE__, vars...) :: Function

Renders the template file as an HTML view.

source
Genie.Renderer.Html.parsehtmlFunction
parsehtml(input::String; partial::Bool = true) :: String
source
parsehtml(elem, output; partial = true) :: String

Parses a HTML tree structure into a string of Julia code.

source
Genie.Renderer.Html.htmlFunction
html(data::String; context::Module = @__MODULE__, status::Int = 200, headers::HTTPHeaders = HTTPHeaders(), layout::Union{String,Nothing} = nothing, vars...) :: HTTP.Response

Parses the data input as HTML, returning a HTML HTTP Response.

Arguments

  • data::String: the HTML string to be rendered
  • context::Module: the module in which the variables are evaluated (in order to provide the scope for vars). Usually the controller.
  • status::Int: status code of the response
  • headers::HTTPHeaders: HTTP response headers
  • layout::Union{String,Nothing}: layout file for rendering data

Example

julia> html("<h1>Welcome $(vars(:name))</h1>", layout = "<div><% @yield %></div>", name = "Adrian")
+HTML Renderer · Genie - The Highly Productive Julia Web Framework
Genie.Renderer.Html.normal_elementFunction
normal_element(f::Function, elem::String, attrs::Vector{Pair{Symbol,Any}} = Pair{Symbol,Any}[]) :: HTMLString

Generates a HTML element in the form <...></...>

source
Genie.Renderer.Html.void_elementFunction
void_element(elem::String, attrs::Vector{Pair{Symbol,String}} = Vector{Pair{Symbol,String}}()) :: HTMLString

Generates a void HTML element in the form <...>

source
Missing docstring.

Missing docstring for skip_element. Check Documenter's build log for details.

Missing docstring.

Missing docstring for include_markdown. Check Documenter's build log for details.

Genie.Renderer.Html.get_templateFunction
get_template(path::String; partial::Bool = true, context::Module = @__MODULE__, vars...) :: Function

Resolves the inclusion and rendering of a template file

source
Genie.Renderer.Html.parseviewFunction
parseview(data::String; partial = false, context::Module = @__MODULE__) :: Function

Parses a view file, returning a rendering function. If necessary, the function is JIT-compiled, persisted and loaded into memory.

source
Genie.Renderer.Html.renderFunction
render(data::String; context::Module = @__MODULE__, layout::Union{String,Nothing} = nothing, vars...) :: Function

Renders the string as an HTML view.

source
render(viewfile::Genie.Renderer.FilePath; layout::Union{Nothing,Genie.Renderer.FilePath} = nothing, context::Module = @__MODULE__, vars...) :: Function

Renders the template file as an HTML view.

source
Genie.Renderer.Html.parsehtmlFunction
parsehtml(input::String; partial::Bool = true) :: String
source
parsehtml(elem, output; partial = true) :: String

Parses a HTML tree structure into a string of Julia code.

source
Genie.Renderer.Html.htmlFunction
html(data::String; context::Module = @__MODULE__, status::Int = 200, headers::HTTPHeaders = HTTPHeaders(), layout::Union{String,Nothing} = nothing, vars...) :: HTTP.Response

Parses the data input as HTML, returning a HTML HTTP Response.

Arguments

  • data::String: the HTML string to be rendered
  • context::Module: the module in which the variables are evaluated (in order to provide the scope for vars). Usually the controller.
  • status::Int: status code of the response
  • headers::HTTPHeaders: HTTP response headers
  • layout::Union{String,Nothing}: layout file for rendering data

Example

julia> html("<h1>Welcome $(vars(:name))</h1>", layout = "<div><% @yield %></div>", name = "Adrian")
 HTTP.Messages.Response:
 "
 HTTP/1.1 200 OK
 Content-Type: text/html; charset=utf-8
 
 <html><head></head><body><div><h1>Welcome Adrian</h1>
-</div></body></html>"
source
html(md::Markdown.MD; context::Module = @__MODULE__, status::Int = 200, headers::Genie.Renderer.HTTPHeaders = Genie.Renderer.HTTPHeaders(), layout::Union{String,Nothing} = nothing, forceparse::Bool = false, vars...) :: Genie.Renderer.HTTP.Response

Markdown view rendering

source
html(viewfile::FilePath; layout::Union{Nothing,FilePath} = nothing,
-      context::Module = @__MODULE__, status::Int = 200, headers::HTTPHeaders = HTTPHeaders(), vars...) :: HTTP.Response

Parses and renders the HTML viewfile, optionally rendering it within the layout file. Valid file format is .html.jl.

Arguments

  • viewfile::FilePath: filesystem path to the view file as a Renderer.FilePath, ie Renderer.filepath("/path/to/file.html.jl") or path"/path/to/file.html.jl"
  • layout::FilePath: filesystem path to the layout file as a Renderer.FilePath, ie Renderer.FilePath("/path/to/file.html.jl") or path"/path/to/file.html.jl"
  • context::Module: the module in which the variables are evaluated (in order to provide the scope for vars). Usually the controller.
  • status::Int: status code of the response
  • headers::HTTPHeaders: HTTP response headers
source
Genie.Renderer.Html.safe_attrFunction
safe_attr(attr) :: String

Replaces illegal Julia characters from HTML attributes with safe ones, to be used as keyword arguments.

source
Missing docstring.

Missing docstring for parsehtml. Check Documenter's build log for details.

Genie.Renderer.Html.string_to_juliaFunction
string_to_julia(content::String; partial = true, f_name::Union{Symbol,Nothing} = nothing, prepend = "") :: String

Converts string view data to Julia code

source
Genie.Renderer.Html.to_juliaFunction
to_julia(input::String, f::Function; partial = true, f_name::Union{Symbol,Nothing} = nothing, prepend = "") :: String

Converts an input file to Julia code

source
Genie.Renderer.Html.partialFunction
partial(path::String; context::Module = @__MODULE__, vars...) :: String

Renders (includes) a view partial within a larger view or layout file.

source
Missing docstring.

Missing docstring for parse. Check Documenter's build log for details.

Missing docstring.

Missing docstring for parsetags. Check Documenter's build log for details.

Genie.Renderer.Html.register_elementFunction
register_element(elem::Union{Symbol,String}, elem_type::Union{Symbol,String} = :normal; context = @__MODULE__) :: Nothing

Generates a Julia function representing an HTML element.

source
Genie.Renderer.Html.register_normal_elementFunction
register_normal_element(elem::Union{Symbol,String}; context = @__MODULE__) :: Nothing

Generates a Julia function representing a "normal" HTML element: that is an element with a closing tag, <tag>...</tag>

source
Genie.Renderer.Html.register_void_elementFunction
register_void_element(elem::Union{Symbol,String}; context::Module = @__MODULE__) :: Nothing

Generates a Julia function representing a "void" HTML element: that is an element without a closing tag, <tag />

source
Missing docstring.

Missing docstring for attr. Check Documenter's build log for details.

Genie.Renderer.Html.for_eachFunction
for_each(f::Function, v)

Iterates over the v Vector and applies function f for each element. The results of each iteration are concatenated and the final string is returned.

source
Genie.Renderer.Html.collectionFunction
collection(template::Function, collection::Vector{T})::String where {T}

Creates a view fragment by repeateadly applying a function to each element of the collection.

source
Genie.Renderer.Html.serve_error_fileFunction
serve_error_file(error_code::Int, error_message::String = "", params::Dict{Symbol,Any} = Dict{Symbol,Any}()) :: Response

Serves the error file correspoding to error_code and current environment.

source
Missing docstring.

Missing docstring for el. Check Documenter's build log for details.

+</div></body></html>"
source
html(md::Markdown.MD; context::Module = @__MODULE__, status::Int = 200, headers::Genie.Renderer.HTTPHeaders = Genie.Renderer.HTTPHeaders(), layout::Union{String,Nothing} = nothing, forceparse::Bool = false, vars...) :: Genie.Renderer.HTTP.Response

Markdown view rendering

source
html(viewfile::FilePath; layout::Union{Nothing,FilePath} = nothing,
+      context::Module = @__MODULE__, status::Int = 200, headers::HTTPHeaders = HTTPHeaders(), vars...) :: HTTP.Response

Parses and renders the HTML viewfile, optionally rendering it within the layout file. Valid file format is .html.jl.

Arguments

  • viewfile::FilePath: filesystem path to the view file as a Renderer.FilePath, ie Renderer.filepath("/path/to/file.html.jl") or path"/path/to/file.html.jl"
  • layout::FilePath: filesystem path to the layout file as a Renderer.FilePath, ie Renderer.FilePath("/path/to/file.html.jl") or path"/path/to/file.html.jl"
  • context::Module: the module in which the variables are evaluated (in order to provide the scope for vars). Usually the controller.
  • status::Int: status code of the response
  • headers::HTTPHeaders: HTTP response headers
source
Genie.Renderer.Html.safe_attrFunction
safe_attr(attr) :: String

Replaces illegal Julia characters from HTML attributes with safe ones, to be used as keyword arguments.

source
Missing docstring.

Missing docstring for parsehtml. Check Documenter's build log for details.

Genie.Renderer.Html.string_to_juliaFunction
string_to_julia(content::String; partial = true, f_name::Union{Symbol,Nothing} = nothing, prepend = "") :: String

Converts string view data to Julia code

source
Genie.Renderer.Html.to_juliaFunction
to_julia(input::String, f::Function; partial = true, f_name::Union{Symbol,Nothing} = nothing, prepend = "") :: String

Converts an input file to Julia code

source
Genie.Renderer.Html.partialFunction
partial(path::String; context::Module = @__MODULE__, vars...) :: String

Renders (includes) a view partial within a larger view or layout file.

source
Missing docstring.

Missing docstring for parse. Check Documenter's build log for details.

Missing docstring.

Missing docstring for parsetags. Check Documenter's build log for details.

Genie.Renderer.Html.register_elementFunction
register_element(elem::Union{Symbol,String}, elem_type::Union{Symbol,String} = :normal; context = @__MODULE__) :: Nothing

Generates a Julia function representing an HTML element.

source
Genie.Renderer.Html.register_normal_elementFunction
register_normal_element(elem::Union{Symbol,String}; context = @__MODULE__) :: Nothing

Generates a Julia function representing a "normal" HTML element: that is an element with a closing tag, <tag>...</tag>

source
Genie.Renderer.Html.register_void_elementFunction
register_void_element(elem::Union{Symbol,String}; context::Module = @__MODULE__) :: Nothing

Generates a Julia function representing a "void" HTML element: that is an element without a closing tag, <tag />

source
Missing docstring.

Missing docstring for attr. Check Documenter's build log for details.

Genie.Renderer.Html.for_eachFunction
for_each(f::Function, v)

Iterates over the v Vector and applies function f for each element. The results of each iteration are concatenated and the final string is returned.

source
Genie.Renderer.Html.collectionFunction
collection(template::Function, collection::Vector{T})::String where {T}

Creates a view fragment by repeateadly applying a function to each element of the collection.

source
Genie.Renderer.Html.serve_error_fileFunction
serve_error_file(error_code::Int, error_message::String = "", params::Dict{Symbol,Any} = Dict{Symbol,Any}()) :: Response

Serves the error file correspoding to error_code and current environment.

source
Missing docstring.

Missing docstring for el. Check Documenter's build log for details.

diff --git a/dev/API/renderer-js.html b/dev/API/renderer-js.html index 83a9c578d..60668708f 100644 --- a/dev/API/renderer-js.html +++ b/dev/API/renderer-js.html @@ -1,2 +1,2 @@ -JS Renderer · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for get_template. Check Documenter's build log for details.

Missing docstring.

Missing docstring for to_js. Check Documenter's build log for details.

Missing docstring.

Missing docstring for render. Check Documenter's build log for details.

Missing docstring.

Missing docstring for js. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Genie.Router.error. Check Documenter's build log for details.

+JS Renderer · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for get_template. Check Documenter's build log for details.

Missing docstring.

Missing docstring for to_js. Check Documenter's build log for details.

Missing docstring.

Missing docstring for render. Check Documenter's build log for details.

Missing docstring.

Missing docstring for js. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Genie.Router.error. Check Documenter's build log for details.

diff --git a/dev/API/renderer-json.html b/dev/API/renderer-json.html index b2f57ade3..c10174dc2 100644 --- a/dev/API/renderer-json.html +++ b/dev/API/renderer-json.html @@ -1,2 +1,2 @@ -JSON Renderer · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for render. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Genie.Renderer.render. Check Documenter's build log for details.

Missing docstring.

Missing docstring for json. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Genie.Router.error. Check Documenter's build log for details.

+JSON Renderer · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for render. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Genie.Renderer.render. Check Documenter's build log for details.

Missing docstring.

Missing docstring for json. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Genie.Router.error. Check Documenter's build log for details.

diff --git a/dev/API/renderer.html b/dev/API/renderer.html index 028d6d47e..106099328 100644 --- a/dev/API/renderer.html +++ b/dev/API/renderer.html @@ -1,2 +1,2 @@ -Renderer · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for render. Check Documenter's build log for details.

Genie.Renderer.redirectFunction

Sets redirect headers and prepares the Response. It accepts 3 parameters: 1 - Label of a Route (to learn more, see the advanced routes section) 2 - Default HTTP 302 Found Status: indicates that the provided resource will be changed to a URL provided 3 - Tuples (key, value) to define the HTTP request header

Example: julia> Genie.Renderer.redirect(:index, 302, Dict("Content-Type" => "application/json; charset=UTF-8"))

HTTP.Messages.Response: HTTP/1.1 302 Moved Temporarily Content-Type: application/json; charset=UTF-8 Location: /index

Redirecting you to /index

source
Missing docstring.

Missing docstring for injectvars. Check Documenter's build log for details.

Genie.Renderer.view_file_infoFunction
view_file_info(path::String, supported_extensions::Vector{String}) :: Tuple{String,String}

Extracts path and extension info about a file

source
Genie.Renderer.vars_signatureFunction
vars_signature() :: String

Collects the names of the view vars in order to create a unique hash/salt to identify compiled views with different vars.

source
Genie.Renderer.build_is_staleFunction
build_is_stale(file_path::String, build_path::String) :: Bool

Checks if the view template has been changed since the last time the template was compiled.

source
Genie.Renderer.build_moduleFunction
build_module(content::String, path::String, mod_name::String) :: String

Persists compiled Julia view data to file and returns the path

source
Genie.Renderer.set_negotiated_contentFunction
set_negotiated_content(req::HTTP.Request, res::HTTP.Response, params::Dict{Symbol,Any})

Configures the request, response, and params response content type based on the request and defaults.

source
Genie.Renderer.negotiate_contentFunction
negotiate_content(req::Request, res::Response, params::Params) :: Response

Computes the content-type of the Response, based on the information in the Request.

source
+Renderer · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for render. Check Documenter's build log for details.

Genie.Renderer.redirectFunction

Sets redirect headers and prepares the Response. It accepts 3 parameters: 1 - Label of a Route (to learn more, see the advanced routes section) 2 - Default HTTP 302 Found Status: indicates that the provided resource will be changed to a URL provided 3 - Tuples (key, value) to define the HTTP request header

Example: julia> Genie.Renderer.redirect(:index, 302, Dict("Content-Type" => "application/json; charset=UTF-8"))

HTTP.Messages.Response: HTTP/1.1 302 Moved Temporarily Content-Type: application/json; charset=UTF-8 Location: /index

Redirecting you to /index

source
Missing docstring.

Missing docstring for injectvars. Check Documenter's build log for details.

Genie.Renderer.view_file_infoFunction
view_file_info(path::String, supported_extensions::Vector{String}) :: Tuple{String,String}

Extracts path and extension info about a file

source
Genie.Renderer.vars_signatureFunction
vars_signature() :: String

Collects the names of the view vars in order to create a unique hash/salt to identify compiled views with different vars.

source
Genie.Renderer.build_is_staleFunction
build_is_stale(file_path::String, build_path::String) :: Bool

Checks if the view template has been changed since the last time the template was compiled.

source
Genie.Renderer.build_moduleFunction
build_module(content::String, path::String, mod_name::String) :: String

Persists compiled Julia view data to file and returns the path

source
Genie.Renderer.set_negotiated_contentFunction
set_negotiated_content(req::HTTP.Request, res::HTTP.Response, params::Dict{Symbol,Any})

Configures the request, response, and params response content type based on the request and defaults.

source
Genie.Renderer.negotiate_contentFunction
negotiate_content(req::Request, res::Response, params::Params) :: Response

Computes the content-type of the Response, based on the information in the Request.

source
diff --git a/dev/API/requests.html b/dev/API/requests.html index 9ebf00565..f7b230043 100644 --- a/dev/API/requests.html +++ b/dev/API/requests.html @@ -1,5 +1,5 @@ -Requests · Genie - The Highly Productive Julia Web Framework
Genie.Requests.jsonpayloadFunction
jsonpayload()

Processes an application/json POST request. If it fails to successfully parse the JSON data it returns nothing. The original payload can still be accessed invoking rawpayload()

source
jsonpayload(v)

Processes an application/json POST request attempting to return value corresponding to key v.

source
Genie.Requests.filespayloadFunction
filespayload() :: Dict{String,HttpFile}

Collection of form uploaded files.

source
filespayload(filename::Union{String,Symbol}) :: HttpFile

Returns the HttpFile uploaded through the key input name.

source
Genie.Requests.infilespayloadFunction
infilespayload(key::Union{String,Symbol}) :: Bool

Checks if the collection of uploaded files contains a file stored under the key name.

source
Base.writeFunction
write(io::IO, x)

Write the canonical binary representation of a value to the given I/O stream or file. Return the number of bytes written into the stream. See also print to write a text representation (with an encoding that may depend upon io).

The endianness of the written value depends on the endianness of the host system. Convert to/from a fixed endianness when writing/reading (e.g. using htol and ltoh) to get results that are consistent across platforms.

You can write multiple values with the same write call. i.e. the following are equivalent:

write(io, x, y...)
+Requests · Genie - The Highly Productive Julia Web Framework
Genie.Requests.jsonpayloadFunction
jsonpayload()

Processes an application/json POST request. If it fails to successfully parse the JSON data it returns nothing. The original payload can still be accessed invoking rawpayload()

source
jsonpayload(v)

Processes an application/json POST request attempting to return value corresponding to key v.

source
Genie.Requests.filespayloadFunction
filespayload() :: Dict{String,HttpFile}

Collection of form uploaded files.

source
filespayload(filename::Union{String,Symbol}) :: HttpFile

Returns the HttpFile uploaded through the key input name.

source
Genie.Requests.infilespayloadFunction
infilespayload(key::Union{String,Symbol}) :: Bool

Checks if the collection of uploaded files contains a file stored under the key name.

source
Base.writeFunction
write(io::IO, x)

Write the canonical binary representation of a value to the given I/O stream or file. Return the number of bytes written into the stream. See also print to write a text representation (with an encoding that may depend upon io).

The endianness of the written value depends on the endianness of the host system. Convert to/from a fixed endianness when writing/reading (e.g. using htol and ltoh) to get results that are consistent across platforms.

You can write multiple values with the same write call. i.e. the following are equivalent:

write(io, x, y...)
 write(io, x) + write(io, y...)

Examples

Consistent serialization:

julia> fname = tempname(); # random temporary filename
 
 julia> open(fname,"w") do f
@@ -33,7 +33,7 @@
 8
 
 julia> seekstart(io); read!(io, Ref(MyStruct(NaN)))
-Base.RefValue{MyStruct}(MyStruct(42.0))
source
Base.readFunction
read(io::IO, T)

Read a single value of type T from io, in canonical binary representation.

Note that Julia does not convert the endianness for you. Use ntoh or ltoh for this purpose.

read(io::IO, String)

Read the entirety of io, as a String (see also readchomp).

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization");
+Base.RefValue{MyStruct}(MyStruct(42.0))
source
Base.readFunction
read(io::IO, T)

Read a single value of type T from io, in canonical binary representation.

Note that Julia does not convert the endianness for you. Use ntoh or ltoh for this purpose.

read(io::IO, String)

Read the entirety of io, as a String (see also readchomp).

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization");
 
 julia> read(io, Char)
 'J': ASCII/Unicode U+004A (category Lu: Letter, uppercase)
@@ -41,7 +41,7 @@
 julia> io = IOBuffer("JuliaLang is a GitHub organization");
 
 julia> read(io, String)
-"JuliaLang is a GitHub organization"
source
read(filename::AbstractString)

Read the entire contents of a file as a Vector{UInt8}.

read(filename::AbstractString, String)

Read the entire contents of a file as a string.

read(filename::AbstractString, args...)

Open a file and read its contents. args is passed to read: this is equivalent to open(io->read(io, args...), filename).

source
read(s::IO, nb=typemax(Int))

Read at most nb bytes from s, returning a Vector{UInt8} of the bytes read.

source
read(s::IOStream, nb::Integer; all=true)

Read at most nb bytes from s, returning a Vector{UInt8} of the bytes read.

If all is true (the default), this function will block repeatedly trying to read all requested bytes, until an error or end-of-file occurs. If all is false, at most one read call is performed, and the amount of data returned is device-dependent. Note that not all stream types support the all option.

source
read(command::Cmd)

Run command and return the resulting output as an array of bytes.

source
read(command::Cmd, String)

Run command and return the resulting output as a String.

source
read(stream::IO, [nb::Integer,] enc::Encoding)
+"JuliaLang is a GitHub organization"
source
read(filename::AbstractString)

Read the entire contents of a file as a Vector{UInt8}.

read(filename::AbstractString, String)

Read the entire contents of a file as a string.

read(filename::AbstractString, args...)

Open a file and read its contents. args is passed to read: this is equivalent to open(io->read(io, args...), filename).

source
read(s::IO, nb=typemax(Int))

Read at most nb bytes from s, returning a Vector{UInt8} of the bytes read.

source
read(s::IOStream, nb::Integer; all=true)

Read at most nb bytes from s, returning a Vector{UInt8} of the bytes read.

If all is true (the default), this function will block repeatedly trying to read all requested bytes, until an error or end-of-file occurs. If all is false, at most one read call is performed, and the amount of data returned is device-dependent. Note that not all stream types support the all option.

source
read(command::Cmd)

Run command and return the resulting output as an array of bytes.

source
read(command::Cmd, String)

Run command and return the resulting output as a String.

source
read(stream::IO, [nb::Integer,] enc::Encoding)
 read(filename::AbstractString, [nb::Integer,] enc::Encoding)
 read(stream::IO, ::Type{String}, enc::Encoding)
-read(filename::AbstractString, ::Type{String}, enc::Encoding)

Methods to read text in character encoding enc. See documentation for corresponding methods without the enc argument for details.

read(file::HttpFile)

Returns the content of file as string.

source
Genie.Requests.postpayloadFunction
postpayload() :: Dict{Symbol,Any}

A dict representing the POST variables payload of the request (corresponding to a form-data request)

source
postpayload(key::Symbol) :: Any

Returns the value of the POST variables key.

source
postpayload(key::Symbol, default::Any)

Returns the value of the POST variables key or the default value if key is not defined.

source
Genie.Requests.getpayloadFunction
getpayload() :: Dict{Symbol,Any}

A dict representing the GET/query variables payload of the request (the part corresponding to ?foo=bar&baz=moo)

source
getpayload(key::Symbol) :: Any

The value of the GET/query variable key, as in ?key=value

source
getpayload(key::Symbol, default::Any) :: Any

The value of the GET/query variable key, as in ?key=value. If key is not defined, default is returned.

source
Genie.Requests.requestFunction
request() :: HTTP.Request

Returns the raw HTTP.Request object associated with the request. If no request is available (not within a request/response cycle) returns nothing.

source
Genie.Requests.payloadFunction
payload() :: Any

Utility function for accessing the params collection, which holds the request variables.

source
payload(key::Symbol) :: Any

Utility function for accessing the key value within the params collection of request variables.

source
payload(key::Symbol, default_value::T) :: Any

Utility function for accessing the key value within the params collection of request variables. If key is not defined, default_value is returned.

source
Genie.Requests.matchedrouteFunction
matchedroute() :: Route

Returns the Route object which was matched for the current request or noting if no route is available.

source
Genie.Requests.matchedchannelFunction
matchedchannel() :: Channel

Returns the Channel object which was matched for the current request or nothing if no channel is available.

source
Genie.Requests.wsclientFunction
wsclient() :: HTTP.WebSockets.WebSocket

The web sockets client for the current request or nothing if not available.

source
+read(filename::AbstractString, ::Type{String}, enc::Encoding)

Methods to read text in character encoding enc. See documentation for corresponding methods without the enc argument for details.

read(file::HttpFile)

Returns the content of file as string.

source
Genie.Requests.postpayloadFunction
postpayload() :: Dict{Symbol,Any}

A dict representing the POST variables payload of the request (corresponding to a form-data request)

source
postpayload(key::Symbol) :: Any

Returns the value of the POST variables key.

source
postpayload(key::Symbol, default::Any)

Returns the value of the POST variables key or the default value if key is not defined.

source
Genie.Requests.getpayloadFunction
getpayload() :: Dict{Symbol,Any}

A dict representing the GET/query variables payload of the request (the part corresponding to ?foo=bar&baz=moo)

source
getpayload(key::Symbol) :: Any

The value of the GET/query variable key, as in ?key=value

source
getpayload(key::Symbol, default::Any) :: Any

The value of the GET/query variable key, as in ?key=value. If key is not defined, default is returned.

source
Genie.Requests.requestFunction
request() :: HTTP.Request

Returns the raw HTTP.Request object associated with the request. If no request is available (not within a request/response cycle) returns nothing.

source
Genie.Requests.payloadFunction
payload() :: Any

Utility function for accessing the params collection, which holds the request variables.

source
payload(key::Symbol) :: Any

Utility function for accessing the key value within the params collection of request variables.

source
payload(key::Symbol, default_value::T) :: Any

Utility function for accessing the key value within the params collection of request variables. If key is not defined, default_value is returned.

source
Genie.Requests.matchedrouteFunction
matchedroute() :: Route

Returns the Route object which was matched for the current request or noting if no route is available.

source
Genie.Requests.matchedchannelFunction
matchedchannel() :: Channel

Returns the Channel object which was matched for the current request or nothing if no channel is available.

source
Genie.Requests.wsclientFunction
wsclient() :: HTTP.WebSockets.WebSocket

The web sockets client for the current request or nothing if not available.

source
diff --git a/dev/API/responses.html b/dev/API/responses.html index bf6f82fcd..74faa1744 100644 --- a/dev/API/responses.html +++ b/dev/API/responses.html @@ -1,2 +1,2 @@ -Responses · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for getresponse. Check Documenter's build log for details.

Missing docstring.

Missing docstring for getheaders. Check Documenter's build log for details.

Missing docstring.

Missing docstring for setheaders!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for setheaders. Check Documenter's build log for details.

Missing docstring.

Missing docstring for getstatus. Check Documenter's build log for details.

Missing docstring.

Missing docstring for setstatus!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for setstatus. Check Documenter's build log for details.

Missing docstring.

Missing docstring for getbody. Check Documenter's build log for details.

Missing docstring.

Missing docstring for setbody!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for setbody. Check Documenter's build log for details.

+Responses · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for getresponse. Check Documenter's build log for details.

Missing docstring.

Missing docstring for getheaders. Check Documenter's build log for details.

Missing docstring.

Missing docstring for setheaders!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for setheaders. Check Documenter's build log for details.

Missing docstring.

Missing docstring for getstatus. Check Documenter's build log for details.

Missing docstring.

Missing docstring for setstatus!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for setstatus. Check Documenter's build log for details.

Missing docstring.

Missing docstring for getbody. Check Documenter's build log for details.

Missing docstring.

Missing docstring for setbody!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for setbody. Check Documenter's build log for details.

diff --git a/dev/API/router.html b/dev/API/router.html index 6eff48d9a..de656315b 100644 --- a/dev/API/router.html +++ b/dev/API/router.html @@ -1,20 +1,20 @@ -Router · Genie - The Highly Productive Julia Web Framework
Base.showFunction
show([io::IO = stdout], x)

Write a text representation of a value x to the output stream io. New types T should overload show(io::IO, x::T). The representation used by show generally includes Julia-specific formatting and type information, and should be parseable Julia code when possible.

repr returns the output of show as a string.

For a more verbose human-readable text output for objects of type T, define show(io::IO, ::MIME"text/plain", ::T) in addition. Checking the :compact IOContext key (often checked as get(io, :compact, false)::Bool) of io in such methods is recommended, since some containers show their elements by calling this method with :compact => true.

See also print, which writes un-decorated representations.

Examples

julia> show("Hello World!")
+Router · Genie - The Highly Productive Julia Web Framework
Base.showFunction
show([io::IO = stdout], x)

Write a text representation of a value x to the output stream io. New types T should overload show(io::IO, x::T). The representation used by show generally includes Julia-specific formatting and type information, and should be parseable Julia code when possible.

repr returns the output of show as a string.

For a more verbose human-readable text output for objects of type T, define show(io::IO, ::MIME"text/plain", ::T) in addition. Checking the :compact IOContext key (often checked as get(io, :compact, false)::Bool) of io in such methods is recommended, since some containers show their elements by calling this method with :compact => true.

See also print, which writes un-decorated representations.

Examples

julia> show("Hello World!")
 "Hello World!"
 julia> print("Hello World!")
-Hello World!
source
show(io::IO, mime, x)

The display functions ultimately call show in order to write an object x as a given mime type to a given I/O stream io (usually a memory buffer), if possible. In order to provide a rich multimedia representation of a user-defined type T, it is only necessary to define a new show method for T, via: show(io, ::MIME"mime", x::T) = ..., where mime is a MIME-type string and the function body calls write (or similar) to write that representation of x to io. (Note that the MIME"" notation only supports literal strings; to construct MIME types in a more flexible manner use MIME{Symbol("")}.)

For example, if you define a MyImage type and know how to write it to a PNG file, you could define a function show(io, ::MIME"image/png", x::MyImage) = ... to allow your images to be displayed on any PNG-capable AbstractDisplay (such as IJulia). As usual, be sure to import Base.show in order to add new methods to the built-in Julia function show.

Technically, the MIME"mime" macro defines a singleton type for the given mime string, which allows us to exploit Julia's dispatch mechanisms in determining how to display objects of any given type.

The default MIME type is MIME"text/plain". There is a fallback definition for text/plain output that calls show with 2 arguments, so it is not always necessary to add a method for that case. If a type benefits from custom human-readable output though, show(::IO, ::MIME"text/plain", ::T) should be defined. For example, the Day type uses 1 day as the output for the text/plain MIME type, and Day(1) as the output of 2-argument show.

Examples

julia> struct Day
+Hello World!
source
show(io::IO, mime, x)

The display functions ultimately call show in order to write an object x as a given mime type to a given I/O stream io (usually a memory buffer), if possible. In order to provide a rich multimedia representation of a user-defined type T, it is only necessary to define a new show method for T, via: show(io, ::MIME"mime", x::T) = ..., where mime is a MIME-type string and the function body calls write (or similar) to write that representation of x to io. (Note that the MIME"" notation only supports literal strings; to construct MIME types in a more flexible manner use MIME{Symbol("")}.)

For example, if you define a MyImage type and know how to write it to a PNG file, you could define a function show(io, ::MIME"image/png", x::MyImage) = ... to allow your images to be displayed on any PNG-capable AbstractDisplay (such as IJulia). As usual, be sure to import Base.show in order to add new methods to the built-in Julia function show.

Technically, the MIME"mime" macro defines a singleton type for the given mime string, which allows us to exploit Julia's dispatch mechanisms in determining how to display objects of any given type.

The default MIME type is MIME"text/plain". There is a fallback definition for text/plain output that calls show with 2 arguments, so it is not always necessary to add a method for that case. If a type benefits from custom human-readable output though, show(::IO, ::MIME"text/plain", ::T) should be defined. For example, the Day type uses 1 day as the output for the text/plain MIME type, and Day(1) as the output of 2-argument show.

Examples

julia> struct Day
            n::Int
        end
 
 julia> Base.show(io::IO, ::MIME"text/plain", d::Day) = print(io, d.n, " day")
 
 julia> Day(1)
-1 day

Container types generally implement 3-argument show by calling show(io, MIME"text/plain"(), x) for elements x, with :compact => true set in an IOContext passed as the first argument.

source
Base.show(io::IO, ex::RuntimeException)

Custom printing of RuntimeException

source
Base.show(io::IO, ex::FileExistsException)

Custom printing for FileExistsException

source
Genie.Router.ParamsType
mutable struct Params{T}

Collection of key value pairs representing the parameters of the current request - response cycle.

source
Genie.Router.ispayloadFunction
ispayload(req::HTTP.Request)

True if the request can carry a payload - that is, it's a POST, PUT, or PATCH request

source
ispayload()

True if the request can carry a payload - that is, it's a POST, PUT, or PATCH request

source
Genie.Router.route_requestFunction
route_request(req::Request, res::Response) :: Response

First step in handling a request: sets up params collection, handles query vars, negotiates content.

source
Genie.Router.route_ws_requestFunction
route_ws_request(req::Request, msg::String, ws_client::HTTP.WebSockets.WebSocket) :: String

First step in handling a web socket request: sets up params collection, handles query vars.

source
Base.push!Function
push!(collection, items...) -> collection

Insert one or more items in collection. If collection is an ordered container, the items are inserted at the end (in the given order).

Examples

julia> push!([1, 2, 3], 4, 5, 6)
+1 day

Container types generally implement 3-argument show by calling show(io, MIME"text/plain"(), x) for elements x, with :compact => true set in an IOContext passed as the first argument.

source
Base.show(io::IO, ex::RuntimeException)

Custom printing of RuntimeException

source
Base.show(io::IO, ex::FileExistsException)

Custom printing for FileExistsException

source
Genie.Router.ParamsType
mutable struct Params{T}

Collection of key value pairs representing the parameters of the current request - response cycle.

source
Genie.Router.ispayloadFunction
ispayload(req::HTTP.Request)

True if the request can carry a payload - that is, it's a POST, PUT, or PATCH request

source
ispayload()

True if the request can carry a payload - that is, it's a POST, PUT, or PATCH request

source
Genie.Router.route_requestFunction
route_request(req::Request, res::Response) :: Response

First step in handling a request: sets up params collection, handles query vars, negotiates content.

source
Genie.Router.route_ws_requestFunction
route_ws_request(req::Request, msg::String, ws_client::HTTP.WebSockets.WebSocket) :: String

First step in handling a web socket request: sets up params collection, handles query vars.

source
Base.push!Function
push!(collection, items...) -> collection

Insert one or more items in collection. If collection is an ordered container, the items are inserted at the end (in the given order).

Examples

julia> push!([1, 2, 3], 4, 5, 6)
 6-element Vector{Int64}:
  1
  2
  3
  4
  5
- 6

If collection is ordered, use append! to add all the elements of another collection to it. The result of the preceding example is equivalent to append!([1, 2, 3], [4, 5, 6]). For AbstractSet objects, union! can be used instead.

See sizehint! for notes about the performance model.

See also pushfirst!.

source
Genie.Router.baptizerFunction
baptizer(params::Union{Route,Channel}, parts::Vector{String}) :: Symbol

Generates default names for routes and channels.

source
Missing docstring.

Missing docstring for routes. Check Documenter's build log for details.

Missing docstring.

Missing docstring for channels. Check Documenter's build log for details.

Genie.Router.delete!Function
delete!(route_name::Symbol)

Removes the route with the corresponding name from the routes collection and returns the collection of remaining routes.

source
Genie.Router.to_linkFunction

Generates the HTTP link corresponding to route_name using the parameters in d.

source

Generates the HTTP link corresponding to route_name using the parameters in route_params.

source
Genie.Router.tolinkFunction

Generates the HTTP link corresponding to route_name using the parameters in d.

source

Generates the HTTP link corresponding to route_name using the parameters in route_params.

source
Genie.Router.link_toFunction

Generates the HTTP link corresponding to route_name using the parameters in d.

source

Generates the HTTP link corresponding to route_name using the parameters in route_params.

source
Genie.Router.linktoFunction

Generates the HTTP link corresponding to route_name using the parameters in d.

source

Generates the HTTP link corresponding to route_name using the parameters in route_params.

source
Genie.Router.torouteFunction

Generates the HTTP link corresponding to route_name using the parameters in d.

source

Generates the HTTP link corresponding to route_name using the parameters in route_params.

source
Genie.Router.action_controller_paramsFunction
action_controller_params(action::Function, params::Params) :: Nothing

Sets up the :action_controller, :action, and :controller key - value pairs of the params collection.

source
Missing docstring.

Missing docstring for run_hook. Check Documenter's build log for details.

Genie.Router.match_routesFunction
match_routes(req::Request, res::Response, params::Params) :: Union{Route,Nothing}

Matches the invoked URL to the corresponding route, sets up the execution environment and invokes the controller method.

source
Genie.Router.match_channelsFunction
match_channels(req::Request, msg::String, ws_client::HTTP.WebSockets.WebSocket, params::Params) :: String

Matches the invoked URL to the corresponding channel, sets up the execution environment and invokes the channel controller method.

source
Genie.Router.parse_routeFunction
parse_route(route::String, context::Module = @__MODULE__) :: Tuple{String,Vector{String},Vector{Any}}

Parses a route and extracts its named params and types. context is used to access optional route parts types.

source
Genie.Router.parse_channelFunction
parse_channel(channel::String) :: Tuple{String,Vector{String},Vector{Any}}

Parses a channel and extracts its named parms and types.

source
Genie.Router.extract_uri_paramsFunction
extract_uri_params(uri::String, regex_route::Regex, param_names::Vector{String}, param_types::Vector{Any}, params::Params) :: Bool

Extracts params from request URI and sets up the params Dict.

source
Genie.Router.nested_keysFunction
nested_keys(k::String, v, params::Params) :: Nothing

Utility function to process nested keys and set them up in params.

source
Genie.Router.setup_base_paramsFunction
setup_base_params(req::Request, res::Response, params::Dict{Symbol,Any}) :: Dict{Symbol,Any}

Populates params with default environment vars.

source
Missing docstring.

Missing docstring for _params_. Check Documenter's build log for details.

Genie.Router.response_typeFunction
response_type{T}(params::Dict{Symbol,T}) :: Symbol
-response_type(params::Params) :: Symbol

Returns the content-type of the current request-response cycle.

source
response_type{T}(check::Symbol, params::Dict{Symbol,T}) :: Bool

Checks if the content-type of the current request-response cycle matches check.

source
Missing docstring.

Missing docstring for to_uri. Check Documenter's build log for details.

Genie.Router.file_pathFunction
file_path(resource::String; within_doc_root = true, root = Genie.config.server_document_root) :: String

Returns the path to a resource file. If within_doc_root it will automatically prepend the document root to resource.

source
Genie.Router.filepathFunction
file_path(resource::String; within_doc_root = true, root = Genie.config.server_document_root) :: String

Returns the path to a resource file. If within_doc_root it will automatically prepend the document root to resource.

source
Missing docstring.

Missing docstring for ormatch. Check Documenter's build log for details.

+ 6

If collection is ordered, use append! to add all the elements of another collection to it. The result of the preceding example is equivalent to append!([1, 2, 3], [4, 5, 6]). For AbstractSet objects, union! can be used instead.

See sizehint! for notes about the performance model.

See also pushfirst!.

source
Genie.Router.baptizerFunction
baptizer(params::Union{Route,Channel}, parts::Vector{String}) :: Symbol

Generates default names for routes and channels.

source
Missing docstring.

Missing docstring for routes. Check Documenter's build log for details.

Missing docstring.

Missing docstring for channels. Check Documenter's build log for details.

Genie.Router.delete!Function
delete!(route_name::Symbol)

Removes the route with the corresponding name from the routes collection and returns the collection of remaining routes.

source
Genie.Router.to_linkFunction

Generates the HTTP link corresponding to route_name using the parameters in d.

source

Generates the HTTP link corresponding to route_name using the parameters in route_params.

source
Genie.Router.tolinkFunction

Generates the HTTP link corresponding to route_name using the parameters in d.

source

Generates the HTTP link corresponding to route_name using the parameters in route_params.

source
Genie.Router.link_toFunction

Generates the HTTP link corresponding to route_name using the parameters in d.

source

Generates the HTTP link corresponding to route_name using the parameters in route_params.

source
Genie.Router.linktoFunction

Generates the HTTP link corresponding to route_name using the parameters in d.

source

Generates the HTTP link corresponding to route_name using the parameters in route_params.

source
Genie.Router.torouteFunction

Generates the HTTP link corresponding to route_name using the parameters in d.

source

Generates the HTTP link corresponding to route_name using the parameters in route_params.

source
Genie.Router.action_controller_paramsFunction
action_controller_params(action::Function, params::Params) :: Nothing

Sets up the :action_controller, :action, and :controller key - value pairs of the params collection.

source
Missing docstring.

Missing docstring for run_hook. Check Documenter's build log for details.

Genie.Router.match_routesFunction
match_routes(req::Request, res::Response, params::Params) :: Union{Route,Nothing}

Matches the invoked URL to the corresponding route, sets up the execution environment and invokes the controller method.

source
Genie.Router.match_channelsFunction
match_channels(req::Request, msg::String, ws_client::HTTP.WebSockets.WebSocket, params::Params) :: String

Matches the invoked URL to the corresponding channel, sets up the execution environment and invokes the channel controller method.

source
Genie.Router.parse_routeFunction
parse_route(route::String, context::Module = @__MODULE__) :: Tuple{String,Vector{String},Vector{Any}}

Parses a route and extracts its named params and types. context is used to access optional route parts types.

source
Genie.Router.parse_channelFunction
parse_channel(channel::String) :: Tuple{String,Vector{String},Vector{Any}}

Parses a channel and extracts its named parms and types.

source
Genie.Router.extract_uri_paramsFunction
extract_uri_params(uri::String, regex_route::Regex, param_names::Vector{String}, param_types::Vector{Any}, params::Params) :: Bool

Extracts params from request URI and sets up the params Dict.

source
Genie.Router.nested_keysFunction
nested_keys(k::String, v, params::Params) :: Nothing

Utility function to process nested keys and set them up in params.

source
Genie.Router.setup_base_paramsFunction
setup_base_params(req::Request, res::Response, params::Dict{Symbol,Any}) :: Dict{Symbol,Any}

Populates params with default environment vars.

source
Missing docstring.

Missing docstring for _params_. Check Documenter's build log for details.

Genie.Router.response_typeFunction
response_type{T}(params::Dict{Symbol,T}) :: Symbol
+response_type(params::Params) :: Symbol

Returns the content-type of the current request-response cycle.

source
response_type{T}(check::Symbol, params::Dict{Symbol,T}) :: Bool

Checks if the content-type of the current request-response cycle matches check.

source
Missing docstring.

Missing docstring for to_uri. Check Documenter's build log for details.

Genie.Router.file_pathFunction
file_path(resource::String; within_doc_root = true, root = Genie.config.server_document_root) :: String

Returns the path to a resource file. If within_doc_root it will automatically prepend the document root to resource.

source
Genie.Router.filepathFunction
file_path(resource::String; within_doc_root = true, root = Genie.config.server_document_root) :: String

Returns the path to a resource file. If within_doc_root it will automatically prepend the document root to resource.

source
Missing docstring.

Missing docstring for ormatch. Check Documenter's build log for details.

diff --git a/dev/API/secrets.html b/dev/API/secrets.html index 15cff319c..e889f788f 100644 --- a/dev/API/secrets.html +++ b/dev/API/secrets.html @@ -1,2 +1,2 @@ -Secrets · Genie - The Highly Productive Julia Web Framework
Genie.Secrets.loadFunction
load(root_dir::String = Genie.config.path_config; context::Union{Module,Nothing} = nothing) :: Nothing

Loads (includes) the framework's secrets.jl file into the app's module context. The files are set up with Revise to be automatically reloaded.

source
Genie.Secrets.secretFunction
secret() :: String

Generates a random secret token to be used for configuring the call to Genie.Secrets.secret_token!.

source
Genie.Secrets.secret_tokenFunction
secret_token(generate_if_missing=true) :: String

Return the secret token used in the app for encryption and salting.

Usually, this token is defined through Genie.Secrets.secret_token! in the config/secrets.jl file. Here, a temporary one is generated for the current session if no other token is defined and generate_if_missing is true.

source
+Secrets · Genie - The Highly Productive Julia Web Framework
Genie.Secrets.loadFunction
load(root_dir::String = Genie.config.path_config; context::Union{Module,Nothing} = nothing) :: Nothing

Loads (includes) the framework's secrets.jl file into the app's module context. The files are set up with Revise to be automatically reloaded.

source
Genie.Secrets.secretFunction
secret() :: String

Generates a random secret token to be used for configuring the call to Genie.Secrets.secret_token!.

source
Genie.Secrets.secret_tokenFunction
secret_token(generate_if_missing=true) :: String

Return the secret token used in the app for encryption and salting.

Usually, this token is defined through Genie.Secrets.secret_token! in the config/secrets.jl file. Here, a temporary one is generated for the current session if no other token is defined and generate_if_missing is true.

source
diff --git a/dev/API/server.html b/dev/API/server.html index f476d8ee0..5249f2c6e 100644 --- a/dev/API/server.html +++ b/dev/API/server.html @@ -1,9 +1,9 @@ -Server · Genie - The Highly Productive Julia Web Framework
Genie.Server.SERVERSConstant
SERVERS

ServersCollection constant containing references to the current app's web and websockets servers.

source
Genie.Server.ServersCollectionType
ServersCollection(webserver::Union{Task,Nothing}, websockets::Union{Task,Nothing})

Represents a object containing references to Genie's web and websockets servers.

source
Genie.Server.downFunction
down(; webserver::Bool = true, websockets::Bool = true) :: ServersCollection

Shuts down the servers optionally indicating which of the webserver and websockets servers to be stopped. It does not remove the servers from the SERVERS collection. Returns the collection.

source
Genie.Server.down!Function
function down!(; webserver::Bool = true, websockets::Bool = true) :: Vector{ServersCollection}

Shuts down all the servers and empties the SERVERS collection. Returns the empty collection.

source
Genie.Server.handle_requestFunction
handle_request(req::HTTP.Request, res::HTTP.Response) :: HTTP.Response

Http server handler function - invoked when the server gets a request.

source
Genie.Server.handle_ws_requestFunction
handle_ws_request(req::HTTP.Request, msg::String, ws_client) :: String

Http server handler function - invoked when the server gets a request.

source
Missing docstring.

Missing docstring for isrunning. Check Documenter's build log for details.

Missing docstring.

Missing docstring for openbrowser. Check Documenter's build log for details.

Missing docstring.

Missing docstring for print_server_status. Check Documenter's build log for details.

Genie.Server.serveFunction
serve(path::String = pwd(), params...; kwparams...)

Serves a folder of static files located at path. Allows Genie to be used as a static files web server. The params and kwparams arguments are forwarded to Genie.up().

Arguments

  • path::String: the folder of static files to be served by the server
  • params: additional arguments which are passed to Genie.up to control the web server
  • kwparams: additional keyword arguments which are passed to Genie.up to control the web server

Examples

julia> Genie.serve("public", 8888, async = false, verbose = true)
+Server · Genie - The Highly Productive Julia Web Framework
Genie.Server.SERVERSConstant
SERVERS

ServersCollection constant containing references to the current app's web and websockets servers.

source
Genie.Server.ServersCollectionType
ServersCollection(webserver::Union{Task,Nothing}, websockets::Union{Task,Nothing})

Represents a object containing references to Genie's web and websockets servers.

source
Genie.Server.downFunction
down(; webserver::Bool = true, websockets::Bool = true) :: ServersCollection

Shuts down the servers optionally indicating which of the webserver and websockets servers to be stopped. It does not remove the servers from the SERVERS collection. Returns the collection.

source
Genie.Server.down!Function
function down!(; webserver::Bool = true, websockets::Bool = true) :: Vector{ServersCollection}

Shuts down all the servers and empties the SERVERS collection. Returns the empty collection.

source
Genie.Server.handle_requestFunction
handle_request(req::HTTP.Request, res::HTTP.Response) :: HTTP.Response

Http server handler function - invoked when the server gets a request.

source
Genie.Server.handle_ws_requestFunction
handle_ws_request(req::HTTP.Request, msg::String, ws_client) :: String

Http server handler function - invoked when the server gets a request.

source
Missing docstring.

Missing docstring for isrunning. Check Documenter's build log for details.

Missing docstring.

Missing docstring for openbrowser. Check Documenter's build log for details.

Missing docstring.

Missing docstring for print_server_status. Check Documenter's build log for details.

Genie.Server.serveFunction
serve(path::String = pwd(), params...; kwparams...)

Serves a folder of static files located at path. Allows Genie to be used as a static files web server. The params and kwparams arguments are forwarded to Genie.up().

Arguments

  • path::String: the folder of static files to be served by the server
  • params: additional arguments which are passed to Genie.up to control the web server
  • kwparams: additional keyword arguments which are passed to Genie.up to control the web server

Examples

julia> Genie.serve("public", 8888, async = false, verbose = true)
 [ Info: Ready!
 2019-08-06 16:39:20:DEBUG:Main: Web Server starting at http://127.0.0.1:8888
 [ Info: Listening on: 127.0.0.1:8888
-[ Info: Accept (1):  🔗    0↑     0↓    1s 127.0.0.1:8888:8888 ≣16
source
Missing docstring.

Missing docstring for server_status. Check Documenter's build log for details.

Genie.Server.setup_http_listenerFunction
setup_http_listener(req::HTTP.Request, res::HTTP.Response = HTTP.Response()) :: HTTP.Response

Configures the handler for the HTTP Request and handles errors.

source
Missing docstring.

Missing docstring for setup_http_streamer. Check Documenter's build log for details.

Genie.Server.upFunction
up(port::Int = Genie.config.server_port, host::String = Genie.config.server_host;
+[ Info: Accept (1):  🔗    0↑     0↓    1s 127.0.0.1:8888:8888 ≣16
source
Missing docstring.

Missing docstring for server_status. Check Documenter's build log for details.

Genie.Server.setup_http_listenerFunction
setup_http_listener(req::HTTP.Request, res::HTTP.Response = HTTP.Response()) :: HTTP.Response

Configures the handler for the HTTP Request and handles errors.

source
Missing docstring.

Missing docstring for setup_http_streamer. Check Documenter's build log for details.

Genie.Server.upFunction
up(port::Int = Genie.config.server_port, host::String = Genie.config.server_host;
     ws_port::Int = Genie.config.websockets_port, async::Bool = ! Genie.config.run_as_server) :: ServersCollection

Starts the web server.

Arguments

  • port::Int: the port used by the web server
  • host::String: the host used by the web server
  • ws_port::Int: the port used by the Web Sockets server
  • async::Bool: run the web server task asynchronously

Examples

julia> up(8000, "127.0.0.1", async = false)
 [ Info: Ready!
-Web Server starting at http://127.0.0.1:8000
source
Genie.Server.update_configFunction
update_config(port::Int, host::String, ws_port::Int) :: Nothing

Updates the corresponding Genie configurations to the corresponding values for port, host, and ws_port, if these are passed as arguments when starting up the server.

source
+Web Server starting at http://127.0.0.1:8000
source
Genie.Server.update_configFunction
update_config(port::Int, host::String, ws_port::Int) :: Nothing

Updates the corresponding Genie configurations to the corresponding values for port, host, and ws_port, if these are passed as arguments when starting up the server.

source
diff --git a/dev/API/sessions.html b/dev/API/sessions.html index 6ca549e58..a91adaeb6 100644 --- a/dev/API/sessions.html +++ b/dev/API/sessions.html @@ -5,10 +5,10 @@ 1 julia> get(d, "c", 3) -3source
get(f::Union{Function, Type}, collection, key)

Return the value stored for the given key, or if no mapping for the key is present, return f(). Use get! to also store the default value in the dictionary.

This is intended to be called using do block syntax

get(dict, key) do
+3
source
get(f::Union{Function, Type}, collection, key)

Return the value stored for the given key, or if no mapping for the key is present, return f(). Use get! to also store the default value in the dictionary.

This is intended to be called using do block syntax

get(dict, key) do
     # default value calculated here
     time()
-end
source
get(x::Nullable[, y])

Attempt to access the value of x. Returns the value if it is present; otherwise, returns y if provided, or throws a NullException if not.

Examples

julia> get(Nullable(5))
+end
source
get(x::Nullable[, y])

Attempt to access the value of x. Returns the value if it is present; otherwise, returns y if provided, or throws a NullException if not.

Examples

julia> get(Nullable(5))
 5
 
 julia> get(Nullable())
@@ -41,4 +41,4 @@
 3
get(f::Function, collection, key)

Return the value stored for the given key, or if no mapping for the key is present, return f(). Use get! to also store the default value in the dictionary.

This is intended to be called using do block syntax

get(dict, key) do
     # default value calculated here
     time()
-end
Missing docstring.

Missing docstring for unset!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for isset. Check Documenter's build log for details.

Missing docstring.

Missing docstring for persist. Check Documenter's build log for details.

Missing docstring.

Missing docstring for load. Check Documenter's build log for details.

Missing docstring.

Missing docstring for session. Check Documenter's build log for details.

Missing docstring.

Missing docstring for init. Check Documenter's build log for details.

+end
Missing docstring.

Missing docstring for unset!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for isset. Check Documenter's build log for details.

Missing docstring.

Missing docstring for persist. Check Documenter's build log for details.

Missing docstring.

Missing docstring for load. Check Documenter's build log for details.

Missing docstring.

Missing docstring for session. Check Documenter's build log for details.

Missing docstring.

Missing docstring for init. Check Documenter's build log for details.

diff --git a/dev/API/toolbox.html b/dev/API/toolbox.html index ee7315e5c..e16c836de 100644 --- a/dev/API/toolbox.html +++ b/dev/API/toolbox.html @@ -1,2 +1,2 @@ -Toolbox · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for TaskInfo. Check Documenter's build log for details.

Missing docstring.

Missing docstring for TaskResult. Check Documenter's build log for details.

Missing docstring.

Missing docstring for tasks. Check Documenter's build log for details.

Missing docstring.

Missing docstring for VoidTaskResult. Check Documenter's build log for details.

Genie.Toolbox.validtasknameFunction
validtaskname(task_name::String) :: String

Attempts to convert a potentially invalid (partial) task_name into a valid one.

source
Genie.Toolbox.taskdocsFunction
task_docs(module_name::Module) :: String

Retrieves the docstring of the runtask method and returns it as a string.

source
Genie.Toolbox.loadtasksFunction
loadtasks(; filter_type_name = Symbol()) :: Vector{TaskInfo}

Returns a vector of all registered Genie tasks.

source
newKeyword
new, or new{A,B,...}

Special function available to inner constructors which creates a new object of the type. The form new{A,B,...} explicitly specifies values of parameters for parametric types. See the manual section on Inner Constructor Methods for more information.

source
Genie.Toolbox.taskfilenameFunction
task_file_name(cmd_args::Dict{String,Any}, config::Settings) :: String

Computes the name of a Genie task based on the command line input.

source
Genie.Toolbox.taskmodulenameFunction
task_module_name(underscored_task_name::String) :: String

Computes the name of a Genie task based on the command line input.

source
Genie.Toolbox.isvalidtask!Function
isvalidtask!(parsed_args::Dict{String,Any}) :: Dict{String,Any}

Checks if the name of the task passed as the command line arg is valid task identifier – if not, attempts to address it, by appending the TASKSUFFIX suffix. Returns the potentially modified `parsedargsDict`.

source
+Toolbox · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for TaskInfo. Check Documenter's build log for details.

Missing docstring.

Missing docstring for TaskResult. Check Documenter's build log for details.

Missing docstring.

Missing docstring for tasks. Check Documenter's build log for details.

Missing docstring.

Missing docstring for VoidTaskResult. Check Documenter's build log for details.

Genie.Toolbox.validtasknameFunction
validtaskname(task_name::String) :: String

Attempts to convert a potentially invalid (partial) task_name into a valid one.

source
Genie.Toolbox.taskdocsFunction
task_docs(module_name::Module) :: String

Retrieves the docstring of the runtask method and returns it as a string.

source
Genie.Toolbox.loadtasksFunction
loadtasks(; filter_type_name = Symbol()) :: Vector{TaskInfo}

Returns a vector of all registered Genie tasks.

source
newKeyword
new, or new{A,B,...}

Special function available to inner constructors which creates a new object of the type. The form new{A,B,...} explicitly specifies values of parameters for parametric types. See the manual section on Inner Constructor Methods for more information.

source
Genie.Toolbox.taskfilenameFunction
task_file_name(cmd_args::Dict{String,Any}, config::Settings) :: String

Computes the name of a Genie task based on the command line input.

source
Genie.Toolbox.taskmodulenameFunction
task_module_name(underscored_task_name::String) :: String

Computes the name of a Genie task based on the command line input.

source
Genie.Toolbox.isvalidtask!Function
isvalidtask!(parsed_args::Dict{String,Any}) :: Dict{String,Any}

Checks if the name of the task passed as the command line arg is valid task identifier – if not, attempts to address it, by appending the TASKSUFFIX suffix. Returns the potentially modified `parsedargsDict`.

source
diff --git a/dev/API/util.html b/dev/API/util.html index 2bcec5846..0dd77859b 100644 --- a/dev/API/util.html +++ b/dev/API/util.html @@ -1,2 +1,2 @@ -Util · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for expand_nullable. Check Documenter's build log for details.

Genie.Util.walk_dirFunction
function walk_dir(dir, paths = String[]; only_extensions = ["jl"], only_files = true, only_dirs = false) :: Vector{String}

Recursively walks dir and produces non directories. If only_files, directories will be skipped. If only_dirs, files will be skipped.

source
Missing docstring.

Missing docstring for time_to_unixtimestamp. Check Documenter's build log for details.

+Util · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for expand_nullable. Check Documenter's build log for details.

Genie.Util.walk_dirFunction
function walk_dir(dir, paths = String[]; only_extensions = ["jl"], only_files = true, only_dirs = false) :: Vector{String}

Recursively walks dir and produces non directories. If only_files, directories will be skipped. If only_dirs, files will be skipped.

source
Missing docstring.

Missing docstring for time_to_unixtimestamp. Check Documenter's build log for details.

diff --git a/dev/API/watch.html b/dev/API/watch.html index e7634f8fc..e4287e372 100644 --- a/dev/API/watch.html +++ b/dev/API/watch.html @@ -1,2 +1,2 @@ -Watch · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for WATCHED_FOLDERS. Check Documenter's build log for details.

Missing docstring.

Missing docstring for WATCHING. Check Documenter's build log for details.

Missing docstring.

Missing docstring for collect_watched_files. Check Documenter's build log for details.

Missing docstring.

Missing docstring for handlers. Check Documenter's build log for details.

Missing docstring.

Missing docstring for unwatch. Check Documenter's build log for details.

Missing docstring.

Missing docstring for watch. Check Documenter's build log for details.

Missing docstring.

Missing docstring for watchpath. Check Documenter's build log for details.

+Watch · Genie - The Highly Productive Julia Web Framework
Missing docstring.

Missing docstring for WATCHED_FOLDERS. Check Documenter's build log for details.

Missing docstring.

Missing docstring for WATCHING. Check Documenter's build log for details.

Missing docstring.

Missing docstring for collect_watched_files. Check Documenter's build log for details.

Missing docstring.

Missing docstring for handlers. Check Documenter's build log for details.

Missing docstring.

Missing docstring for unwatch. Check Documenter's build log for details.

Missing docstring.

Missing docstring for watch. Check Documenter's build log for details.

Missing docstring.

Missing docstring for watchpath. Check Documenter's build log for details.

diff --git a/dev/API/webchannels.html b/dev/API/webchannels.html index 7b7e91896..c9f90cc19 100644 --- a/dev/API/webchannels.html +++ b/dev/API/webchannels.html @@ -5,10 +5,10 @@ "A" => 1

Alternatively, a sequence of pair arguments may be passed.

julia> Dict("A"=>1, "B"=>2)
 Dict{String, Int64} with 2 entries:
   "B" => 2
-  "A" => 1
source
Genie.WebChannels.ChannelSubscriptionsCollectionType
Dict([itr])

Dict{K,V}() constructs a hash table with keys of type K and values of type V. Keys are compared with isequal and hashed with hash.

Given a single iterable argument, constructs a Dict whose key-value pairs are taken from 2-tuples (key,value) generated by the argument.

Examples

julia> Dict([("A", 1), ("B", 2)])
+  "A" => 1
source
Genie.WebChannels.ChannelSubscriptionsCollectionType
Dict([itr])

Dict{K,V}() constructs a hash table with keys of type K and values of type V. Keys are compared with isequal and hashed with hash.

Given a single iterable argument, constructs a Dict whose key-value pairs are taken from 2-tuples (key,value) generated by the argument.

Examples

julia> Dict([("A", 1), ("B", 2)])
 Dict{String, Int64} with 2 entries:
   "B" => 2
   "A" => 1

Alternatively, a sequence of pair arguments may be passed.

julia> Dict("A"=>1, "B"=>2)
 Dict{String, Int64} with 2 entries:
   "B" => 2
-  "A" => 1
source
Missing docstring.

Missing docstring for MessagePayload. Check Documenter's build log for details.

Missing docstring.

Missing docstring for ChannelMessage. Check Documenter's build log for details.

Missing docstring.

Missing docstring for CLIENTS. Check Documenter's build log for details.

Missing docstring.

Missing docstring for SUBSCRIPTIONS. Check Documenter's build log for details.

Missing docstring.

Missing docstring for clients. Check Documenter's build log for details.

Missing docstring.

Missing docstring for subscriptions. Check Documenter's build log for details.

Missing docstring.

Missing docstring for websockets. Check Documenter's build log for details.

Missing docstring.

Missing docstring for channels. Check Documenter's build log for details.

Missing docstring.

Missing docstring for connected_clients. Check Documenter's build log for details.

Missing docstring.

Missing docstring for disconnected_clients. Check Documenter's build log for details.

Genie.WebChannels.subscribeFunction

Subscribes a web socket client ws to channel.

source
Genie.WebChannels.unsubscribeFunction

Unsubscribes a web socket client ws from channel.

source
Genie.WebChannels.unsubscribe_clientFunction

Unsubscribes a web socket client ws from all the channels.

source
Genie.WebChannels.unsubscribe_disconnected_clientsFunction

unsubscribedisconnectedclients() :: ChannelClientsCollection

Unsubscribes clients which are no longer connected.

source
Genie.WebChannels.push_subscriptionFunction

Adds a new subscription for client to channel.

source
Genie.WebChannels.pop_subscriptionFunction

Removes the subscription of client to channel.

source

Removes all subscriptions of client.

source
Genie.WebChannels.broadcastFunction

Pushes msg (and payload) to all the clients subscribed to the channels in channels, with the exception of except.

source

Pushes msg (and payload) to all the clients subscribed to the channels in channels, with the exception of except.

source
Genie.WebChannels.messageFunction

Writes msg to web socket for client.

source
+ "A" => 1source
Missing docstring.

Missing docstring for MessagePayload. Check Documenter's build log for details.

Missing docstring.

Missing docstring for ChannelMessage. Check Documenter's build log for details.

Missing docstring.

Missing docstring for CLIENTS. Check Documenter's build log for details.

Missing docstring.

Missing docstring for SUBSCRIPTIONS. Check Documenter's build log for details.

Missing docstring.

Missing docstring for clients. Check Documenter's build log for details.

Missing docstring.

Missing docstring for subscriptions. Check Documenter's build log for details.

Missing docstring.

Missing docstring for websockets. Check Documenter's build log for details.

Missing docstring.

Missing docstring for channels. Check Documenter's build log for details.

Missing docstring.

Missing docstring for connected_clients. Check Documenter's build log for details.

Missing docstring.

Missing docstring for disconnected_clients. Check Documenter's build log for details.

Genie.WebChannels.subscribeFunction

Subscribes a web socket client ws to channel.

source
Genie.WebChannels.unsubscribeFunction

Unsubscribes a web socket client ws from channel.

source
Genie.WebChannels.unsubscribe_clientFunction

Unsubscribes a web socket client ws from all the channels.

source
Genie.WebChannels.unsubscribe_disconnected_clientsFunction

unsubscribedisconnectedclients() :: ChannelClientsCollection

Unsubscribes clients which are no longer connected.

source
Genie.WebChannels.push_subscriptionFunction

Adds a new subscription for client to channel.

source
Genie.WebChannels.pop_subscriptionFunction

Removes the subscription of client to channel.

source

Removes all subscriptions of client.

source
Genie.WebChannels.broadcastFunction

Pushes msg (and payload) to all the clients subscribed to the channels in channels, with the exception of except.

source

Pushes msg (and payload) to all the clients subscribed to the channels in channels, with the exception of except.

source
Genie.WebChannels.messageFunction

Writes msg to web socket for client.

source
diff --git a/dev/API/webthreads.html b/dev/API/webthreads.html index 40fdd46a9..0a43dd398 100644 --- a/dev/API/webthreads.html +++ b/dev/API/webthreads.html @@ -5,10 +5,10 @@ "A" => 1

Alternatively, a sequence of pair arguments may be passed.

julia> Dict("A"=>1, "B"=>2)
 Dict{String, Int64} with 2 entries:
   "B" => 2
-  "A" => 1
source
Missing docstring.

Missing docstring for ChannelMessage. Check Documenter's build log for details.

Genie.WebThreads.ChannelSubscriptionsCollectionType
Dict([itr])

Dict{K,V}() constructs a hash table with keys of type K and values of type V. Keys are compared with isequal and hashed with hash.

Given a single iterable argument, constructs a Dict whose key-value pairs are taken from 2-tuples (key,value) generated by the argument.

Examples

julia> Dict([("A", 1), ("B", 2)])
+  "A" => 1
source
Missing docstring.

Missing docstring for ChannelMessage. Check Documenter's build log for details.

Genie.WebThreads.ChannelSubscriptionsCollectionType
Dict([itr])

Dict{K,V}() constructs a hash table with keys of type K and values of type V. Keys are compared with isequal and hashed with hash.

Given a single iterable argument, constructs a Dict whose key-value pairs are taken from 2-tuples (key,value) generated by the argument.

Examples

julia> Dict([("A", 1), ("B", 2)])
 Dict{String, Int64} with 2 entries:
   "B" => 2
   "A" => 1

Alternatively, a sequence of pair arguments may be passed.

julia> Dict("A"=>1, "B"=>2)
 Dict{String, Int64} with 2 entries:
   "B" => 2
-  "A" => 1
source
Genie.WebThreads.ClientIdType
UInt64 <: Unsigned

64-bit unsigned integer type.

source
Genie.WebThreads.ChannelNameType
String <: AbstractString

The default string type in Julia, used by e.g. string literals.

Strings are immutable sequences of Chars. A String is stored internally as a contiguous byte array, and while they are interpreted as being UTF-8 encoded, they can be composed of any byte sequence. Use isvalid to validate that the underlying byte sequence is valid as UTF-8.

source
Missing docstring.

Missing docstring for MessagePayload. Check Documenter's build log for details.

Genie.WebThreads.broadcastFunction

Pushes msg (and payload) to all the clients subscribed to the channels in channels.

source

Pushes msg (and payload) to all the clients subscribed to all the channels.

source
Missing docstring.

Missing docstring for channels. Check Documenter's build log for details.

Missing docstring.

Missing docstring for clients. Check Documenter's build log for details.

Missing docstring.

Missing docstring for connected_clients. Check Documenter's build log for details.

Missing docstring.

Missing docstring for disconnected_clients. Check Documenter's build log for details.

Genie.WebThreads.messageFunction

Pushes msg (and payload) to channel.

source

Writes msg to message queue for client.

source
Genie.WebThreads.pop_subscriptionFunction

Removes the subscription of client to channel.

source

Removes all subscriptions of client.

source
Missing docstring.

Missing docstring for pull. Check Documenter's build log for details.

Missing docstring.

Missing docstring for push. Check Documenter's build log for details.

Genie.WebThreads.push_subscriptionFunction

Adds a new subscription for client to channel.

source
Genie.WebThreads.subscribeFunction

Subscribes a web thread client wt to channel.

source
Missing docstring.

Missing docstring for subscriptions. Check Documenter's build log for details.

Missing docstring.

Missing docstring for timestamp_client. Check Documenter's build log for details.

Genie.WebThreads.unsubscribeFunction

Unsubscribes a web socket client wt from channel.

source
Genie.WebThreads.unsubscribe_clientFunction

Unsubscribes a web socket client wt from all the channels.

source
Missing docstring.

Missing docstring for unsubscribe_clients. Check Documenter's build log for details.

Genie.WebThreads.unsubscribe_disconnected_clientsFunction

unsubscribedisconnectedclients() :: ChannelClientsCollection

Unsubscribes clients which are no longer connected.

source
Missing docstring.

Missing docstring for webthreads. Check Documenter's build log for details.

+ "A" => 1source
Genie.WebThreads.ClientIdType
UInt64 <: Unsigned

64-bit unsigned integer type.

source
Genie.WebThreads.ChannelNameType
String <: AbstractString

The default string type in Julia, used by e.g. string literals.

Strings are immutable sequences of Chars. A String is stored internally as a contiguous byte array, and while they are interpreted as being UTF-8 encoded, they can be composed of any byte sequence. Use isvalid to validate that the underlying byte sequence is valid as UTF-8.

source
Missing docstring.

Missing docstring for MessagePayload. Check Documenter's build log for details.

Genie.WebThreads.broadcastFunction

Pushes msg (and payload) to all the clients subscribed to the channels in channels.

source

Pushes msg (and payload) to all the clients subscribed to all the channels.

source
Missing docstring.

Missing docstring for channels. Check Documenter's build log for details.

Missing docstring.

Missing docstring for clients. Check Documenter's build log for details.

Missing docstring.

Missing docstring for connected_clients. Check Documenter's build log for details.

Missing docstring.

Missing docstring for disconnected_clients. Check Documenter's build log for details.

Genie.WebThreads.messageFunction

Pushes msg (and payload) to channel.

source

Writes msg to message queue for client.

source
Genie.WebThreads.pop_subscriptionFunction

Removes the subscription of client to channel.

source

Removes all subscriptions of client.

source
Missing docstring.

Missing docstring for pull. Check Documenter's build log for details.

Missing docstring.

Missing docstring for push. Check Documenter's build log for details.

Genie.WebThreads.push_subscriptionFunction

Adds a new subscription for client to channel.

source
Genie.WebThreads.subscribeFunction

Subscribes a web thread client wt to channel.

source
Missing docstring.

Missing docstring for subscriptions. Check Documenter's build log for details.

Missing docstring.

Missing docstring for timestamp_client. Check Documenter's build log for details.

Genie.WebThreads.unsubscribeFunction

Unsubscribes a web socket client wt from channel.

source
Genie.WebThreads.unsubscribe_clientFunction

Unsubscribes a web socket client wt from all the channels.

source
Missing docstring.

Missing docstring for unsubscribe_clients. Check Documenter's build log for details.

Genie.WebThreads.unsubscribe_disconnected_clientsFunction

unsubscribedisconnectedclients() :: ChannelClientsCollection

Unsubscribes clients which are no longer connected.

source
Missing docstring.

Missing docstring for webthreads. Check Documenter's build log for details.

diff --git a/dev/guides/Controlling_Load_Order_Of_Genie_Apps.html b/dev/guides/Controlling_Load_Order_Of_Genie_Apps.html index e57a42e46..a9b983138 100644 --- a/dev/guides/Controlling_Load_Order_Of_Genie_Apps.html +++ b/dev/guides/Controlling_Load_Order_Of_Genie_Apps.html @@ -13,4 +13,4 @@ -Foo.jl

where (-) means exclude the file from Genie's autoload sequence and (–) means remove file starting with (-) from Genie Load sequence. Now the load order of our directory is going to be

def.jl
 Abc.jl
 Aaa.jl
-Abb.jl
+Abb.jl diff --git a/dev/guides/Deploying_Genie_Apps_On_AWS.html b/dev/guides/Deploying_Genie_Apps_On_AWS.html index 94cd87839..74d508534 100644 --- a/dev/guides/Deploying_Genie_Apps_On_AWS.html +++ b/dev/guides/Deploying_Genie_Apps_On_AWS.html @@ -9,4 +9,4 @@ # And clone your git repo git clone <your-repo.git> cd <your-repo>

Building a Genie Application

First of all let’s build our app using docker cli

docker build -t my-demo-app .
-docker images 

If build was successful your should be able to see docker image. Now let’s just start it. In our case application works on port 8000, so we did a port-mapping to port 80.

docker run -p 80:8000 my-demo-app

Then just grep a public IP from AWS console and open it in your browser.

deployed-app

That’s it, your application was successfully deployed. Thanks.

+docker images

If build was successful your should be able to see docker image. Now let’s just start it. In our case application works on port 8000, so we did a port-mapping to port 80.

docker run -p 80:8000 my-demo-app

Then just grep a public IP from AWS console and open it in your browser.

deployed-app

That’s it, your application was successfully deployed. Thanks.

diff --git a/dev/guides/Genie_Plugins.html b/dev/guides/Genie_Plugins.html index f7d6b1e53..c513b561a 100644 --- a/dev/guides/Genie_Plugins.html +++ b/dev/guides/Genie_Plugins.html @@ -65,4 +65,4 @@ isdir(f) || continue GeniePlugins.install(joinpath(src, f), dest, force = force) end -end

You can use it as a starting point - and add any other specific extra logic to it.

+end

You can use it as a starting point - and add any other specific extra logic to it.

diff --git a/dev/guides/Interactive_environment.html b/dev/guides/Interactive_environment.html index 6cf8d7ac8..23a44a744 100644 --- a/dev/guides/Interactive_environment.html +++ b/dev/guides/Interactive_environment.html @@ -12,4 +12,4 @@ params(:x) + params(:y) end

By default, route params are extracted as SubString (more exactly, SubString{String}). If type constraints are added, Genie will attempt to convert the SubString to the indicated type.

For the above to work, we also need to tell Genie how to perform the conversion:

julia> Base.convert(::Type{Int}, s::AbstractString) = parse(Int, s)

Now if we access http://localhost:8000/sum/2/3 we should see 5

Handling query params

Query params, which look like ...?foo=bar&baz=2 are automatically unpacked by Genie and placed into the params collection. For example:

julia> route("/sum/:x::Int/:y::Int") do
          params(:x) + params(:y) + parse(Int, get(params, :initial_value, "0"))
-       end

Accessing http://localhost:8000/sum/2/3?initial_value=10 will now output 15.

+ end

Accessing http://localhost:8000/sum/2/3?initial_value=10 will now output 15.

diff --git a/dev/guides/Migrating_from_v4_to_v5.html b/dev/guides/Migrating_from_v4_to_v5.html index e17aacbe4..476a2e223 100644 --- a/dev/guides/Migrating_from_v4_to_v5.html +++ b/dev/guides/Migrating_from_v4_to_v5.html @@ -11,4 +11,4 @@ end

If your app does not use output_flash then you can just remove the ViewHelper file.

julia> rm("app/helpers/ViewHelper.jl")

4. All references to app resources (controllers and models)

In Genie v5, the app resources such as controllers and models were accessible directly in routes.jl and in any other resource. For instance, let's say that we have:

In v4 we could access them directly in routes.jl (or in other controllers and models) as using HomeController, Home.

However, in Genie v5 all the app's resources are scoped to the app's main module. So we need to update all references to the app resources to use the app's main module, meaning that in v5 we'll need using WelcomeHome.HomeController, WelcomeHome.Home.

We can also dynamically reference the app's main module by using ..Main.UserApp (so ..Main.UserApp is the same as WelcomeHome in our example).

5. Genie.Cache

In Genie v5, the Genie.Cache module has been moved to a dedicated plugin called GenieCache.jl. This means that all references to Genie.Cache need to be updated to use GenieCache.

This change was made to provide a leaner Genie core, making caching features opt-in. But also to allow the independent development of the caching features, independent from Genie itself.

6. Genie.Cache.FileCache

Starting with Genie 5, the file-based caching functionality provided by Genie.Cache.FileCache has been moved to a dedicated plugin called GenieCacheFileCache.jl. This means that all references to Genie.Cache.FileCache need to be updated to use GenieCacheFileCache. The GenieCacheFileCache plugin is dependent on the GenieCache package and it extends the functionality of GenieCache.

In the future, additional cache backends will be released.

7. Genie.Session

As mentioned above, the Genie.Session module has been moved to a dedicated plugin called GenieSession.jl. This means that all references to Genie.Session need to be updated to use GenieSession.

This change was made to provide a leaner Genie core, making session related features opt-in. But also to allow the independent development of the session features, independent from Genie itself.

8. Genie.Session.FileSession

Starting with Genie 5, the file-based session storage provided by Genie.Session.FileSession has been moved to a dedicated plugin called GenieSessionFileSession.jl. This means that all references to Genie.Session.FileSession need to be updated to use GenieSessionFileSession. The GenieSessionFileSession plugin is dependent on the GenieSession package and it extends the functionality of GenieSession.

In the future, additional session storage backends will be released.

9. Genie.Deploy

Similar to Genie.Session and Genie.Cache, the Genie.Deploy module has been moved to a dedicated plugin called GenieDeploy.jl. This means that all references to Genie.Deploy need to be updated to use GenieDeploy.

10. Genie.Deploy.Docker

Starting with Genie 5, the Docker deployment functionality provided by Genie.Deploy.Docker has been moved to a dedicated plugin called GenieDeployDocker.jl. This means that all references to Genie.Deploy.Docker need to be updated to use GenieDeployDocker. The GenieDeployDocker plugin is dependent on the GenieDeploy package and it extends the functionality of GenieDeploy.

11. Genie.Deploy.Heroku

Starting with Genie 5, the Heroku deployment functionality provided by Genie.Deploy.Heroku has been moved to a dedicated plugin called GenieDeployHeroku.jl. This means that all references to Genie.Deploy.Heroku need to be updated to use GenieDeployHeroku. The GenieDeployHeroku plugin is dependent on the GenieDeploy package and it extends the functionality of GenieDeploy.

12. Genie.Deploy.JuliaHub

Starting with Genie 5, the JuliaHub deployment functionality provided by Genie.Deploy.JuliaHub has been moved to a dedicated plugin called GenieDeployJuliaHub.jl. This means that all references to Genie.Deploy.JuliaHub need to be updated to use GenieDeployJuliaHub. The GenieDeployJuliaHub plugin is dependent on the GenieDeploy package and it extends the functionality of GenieDeploy.

13. Genie.App

The Genie.App module has been removed in v5 and its API has been moved to the Genie module.

14. Genie.AppServer

The Genie.AppServer module has been renamed to Genie.Server in v5.

15. Genie.Plugins

Starting with Genie 5, the Genie.Plugins functionality has been moved to a dedicated plugin called GeniePlugins.jl. This means that all references to Genie.Plugins need to be updated to use GeniePlugins. The GeniePlugins plugin is dependent on the Genie package and it extends the functionality of Genie.

16. Genie.new family of functions

All the Genie.new functions have been moved to Genie.Generator in v5.

17. No automatic import of Genie in Main (at REPL)

Genie v4 apps would automatically import Genie in Main, so that Genie would be readily available at the REPL. Starting with Genie 5, this is no longer the case and at the app's REPL it's now necessary to first run julia> using Genie.

18. Modification of bin/server and bin/server.bat

The scripts responsible for starting the app in non-interactive/serving mode need to be updated by replacing the end of the command from s "$@" to -s=true "$@".

19. Update config/initializers/logging.jl

Update the content of the logging.jl initializer to this:

import Genie
 
-Genie.Logger.initialize_logging()

20. Other

Genie 5 also changes or removes other APIs which can be generally be considered as internal. If you find other important breaking changes that have been missed, please open an issue on the Genie GitHub repository or just edit this file and submit a PR.

+Genie.Logger.initialize_logging()

20. Other

Genie 5 also changes or removes other APIs which can be generally be considered as internal. If you find other important breaking changes that have been missed, please open an issue on the Genie GitHub repository or just edit this file and submit a PR.

diff --git a/dev/guides/Simple_API_backend.html b/dev/guides/Simple_API_backend.html index 064f50793..d9c84d583 100644 --- a/dev/guides/Simple_API_backend.html +++ b/dev/guides/Simple_API_backend.html @@ -25,4 +25,4 @@ up(async = false)

Here we define two routes, /send and /echo. The send route makes a HTTP request over POST to /echo, sending a JSON payload with two values, message and repeat. In the /echo route, we grab the JSON payload using the Requests.jsonpayload() function, extract the values from the JSON object, and output the message value repeated for a number of times equal to the repeat value.

If you run the code, the output should be

{
   echo: "hello hello hello "
-}

If the payload contains invalid JSON, the jsonpayload will be set to nothing. You can still access the raw payload by using the Requests.rawpayload() function. You can also use rawpayload if for example the type of request/payload is not JSON.

+}

If the payload contains invalid JSON, the jsonpayload will be set to nothing. You can still access the raw payload by using the Requests.rawpayload() function. You can also use rawpayload if for example the type of request/payload is not JSON.

diff --git a/dev/guides/Working_With_Genie_Apps.html b/dev/guides/Working_With_Genie_Apps.html index ce4995ed1..73813b2d5 100644 --- a/dev/guides/Working_With_Genie_Apps.html +++ b/dev/guides/Working_With_Genie_Apps.html @@ -370,4 +370,4 @@ "title": "Leonardo da Vinci" } ] -}

PRO TIP

SearchLight exposes two similar data persistence methods: save! and save. They both perform the same action (persisting the object to the database), but save will return a Bool of value true to indicate that the operation was successful or a Bool of value false to indicate that the operation has failed. While the save! variant will return the persisted object upon success or will throw an exception on failure.


Congratulations

You have successfully finished the first part of the step by step walkthrough - you have mastered the Genie basics, allowing you to set up a new app, register routes, add resources (controllers, models, and views), add database support, version the database schema with migrations, and execute basic queries with SearchLight!

In the next part we'll look at more advanced topics like handling forms and file uploads, templates rendering, interactivity and more.

+}

PRO TIP

SearchLight exposes two similar data persistence methods: save! and save. They both perform the same action (persisting the object to the database), but save will return a Bool of value true to indicate that the operation was successful or a Bool of value false to indicate that the operation has failed. While the save! variant will return the persisted object upon success or will throw an exception on failure.


Congratulations

You have successfully finished the first part of the step by step walkthrough - you have mastered the Genie basics, allowing you to set up a new app, register routes, add resources (controllers, models, and views), add database support, version the database schema with migrations, and execute basic queries with SearchLight!

In the next part we'll look at more advanced topics like handling forms and file uploads, templates rendering, interactivity and more.

diff --git a/dev/guides/Working_With_Genie_Apps_Intermediary_Topics.html b/dev/guides/Working_With_Genie_Apps_Intermediary_Topics.html index 6f93dee83..08a9cd133 100644 --- a/dev/guides/Working_With_Genie_Apps_Intermediary_Topics.html +++ b/dev/guides/Working_With_Genie_Apps_Intermediary_Topics.html @@ -107,4 +107,4 @@ %> </ul>

Here we check if the cover property is not empty, and display the actual cover. Otherwise we show a placeholder image. You can check the result at http://localhost:8000/bgbooks

As for the JSON view, it already does what we want - you can check that the cover property is now outputted, as stored in the database: http://localhost:8000/api/v1/bgbooks

Success, we're done here!

Heads up!

In production you will have to make the upload code more robust - the big problem here is that we store the cover file as it comes from the user which can lead to name clashes and files being overwritten - not to mention security vulnerabilities. A more robust way would be to compute a hash based on author and title and rename the cover to that.

One more thing

So far so good, but what if we want to update the books we have already uploaded? It would be nice to add those missing covers. We need to add a bit of functionality to include editing features.

First things first - let's add the routes. Please add these two new route definitions to the routes.jl file:

route("/bgbooks/:id::Int/edit", BooksController.edit)
 route("/bgbooks/:id::Int/update", BooksController.update, method = POST, named = :update_book)

We defined two new routes. The first will display the book object in the form, for editing. While the second will take care of actually updating the database, server side. For both routes we need to pass the id of the book that we want to edit - and we want to constrain it to an Int. We express this as the /:id::Int/ part of the route.

We also want to:

OK, that's quite a list and this is where things become interesting. This is an important design pattern for CRUD web apps. In order to simplify the rendering of the form, we will always pass a book object into it. When editing a book it will be the book corresponding to the id passed into the route. And when creating a new book, it will be just an empty book object we'll create and then dispose of.

Using view partials

First, let's set up the views. In app/resources/books/views/ please create a new file called form.jl.html. Then, from app/resources/books/views/new.jl.html cut the <form> code. That is, everything between the opening and closing <form>...</form> tags. Paste it into the newly created form.jl.html file. Now, back to new.jl.html, instead of the previous <form>...</form> code add:

<% partial("app/resources/books/views/form.jl.html", context = @__MODULE__) %>

This line, as the partial function suggests, includes a view partial, which is a part of a view file, effectively including a view within another view. Notice that we're explicitly passing the context so Genie can set the correct variable scope when including the partial.

You can reload the new page to make sure that everything still works: http://localhost:8000/bgbooks/new

Now, let's add an Edit option to our list of books. Please go back to our list view file, billgatesbooks.jl.html. Here, for each iteration, within the for_each block we'll want to dynamically link to the edit page for the corresponding book.

for_each with view partials

However, this for_each which renders a Julia string is very ugly - and we now know how to refactor it, by using a view partial. Let's do it. First, replace the body of the for_each block:

<!-- app/resources/books/views/billgatesbooks.jl.html -->
-"""<li><img src='$( isempty(book.cover) ? "img/docs.png" : book.cover )' width="100px" /> $(book.title) by $(book.author)"""

with:

partial("app/resources/books/views/book.jl.html", book = book, context = @__MODULE__)

Notice that we are using the partial function and we pass the book object into our view, under the name book (will be accessible in book inside the view partial). Again, we're passing the scope's context (our controller object).

Next, create the book.jl.html in app/resources/books/views/, for example with

julia> touch("app/resources/books/views/book.jl.html")

Add this content to it: TO BE CONTINUED

+"""<li><img src='$( isempty(book.cover) ? "img/docs.png" : book.cover )' width="100px" /> $(book.title) by $(book.author)"""

with:

partial("app/resources/books/views/book.jl.html", book = book, context = @__MODULE__)

Notice that we are using the partial function and we pass the book object into our view, under the name book (will be accessible in book inside the view partial). Again, we're passing the scope's context (our controller object).

Next, create the book.jl.html in app/resources/books/views/, for example with

julia> touch("app/resources/books/views/book.jl.html")

Add this content to it: TO BE CONTINUED

diff --git a/dev/index.html b/dev/index.html index 1748e4e79..d5c341467 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · Genie - The Highly Productive Julia Web Framework

Genie

Genie Logo

Genie

The highly productive Julia web framework

Genie is a full-stack MVC web framework that provides a streamlined and efficient workflow for developing modern web applications. It builds on Julia's strengths (high-level, high-performance, dynamic, JIT compiled), exposing a rich API and a powerful toolset for productive web development.

Current status

Genie is compatible with Julia v1.6 and up.


Documentation

https://genieframework.github.io/Genie.jl/dev/


Acknowledgements

  • Genie uses a multitude of packages that have been kindly contributed by the Julia community.
  • The awesome Genie logo was designed by Alvaro Casanova.
+Home · Genie - The Highly Productive Julia Web Framework

Genie

Genie Logo

Genie

The highly productive Julia web framework

Genie is a full-stack MVC web framework that provides a streamlined and efficient workflow for developing modern web applications. It builds on Julia's strengths (high-level, high-performance, dynamic, JIT compiled), exposing a rich API and a powerful toolset for productive web development.

Current status

Genie is compatible with Julia v1.6 and up.


Documentation

https://genieframework.github.io/Genie.jl/dev/


Acknowledgements

  • Genie uses a multitude of packages that have been kindly contributed by the Julia community.
  • The awesome Genie logo was designed by Alvaro Casanova.
diff --git a/dev/search.html b/dev/search.html index 090cb93c3..3b27bd412 100644 --- a/dev/search.html +++ b/dev/search.html @@ -1,2 +1,2 @@ -Search · Genie - The Highly Productive Julia Web Framework

Loading search...

    +Search · Genie - The Highly Productive Julia Web Framework

    Loading search...

      diff --git a/dev/tutorials/1--Overview.html b/dev/tutorials/1--Overview.html index fb6d0a2a9..9498c60ba 100644 --- a/dev/tutorials/1--Overview.html +++ b/dev/tutorials/1--Overview.html @@ -1,2 +1,2 @@ -Welcome to Genie · Genie - The Highly Productive Julia Web Framework

      Welcome to Genie

      The Highly Productive Web Framework for Julia

      Genie is a full stack web framework for the Julia programming language. Genie's goals are: excellent developer productivity, great run-time performance, and best practices and security by default.

      The Genie web framework follows in the footsteps of mainstream full stack web frameworks like Ruby on Rails and Django, while staying 100% true to its Julia roots. Genie's architecture and development is inspired by the best features present in other frameworks, but not by their design. Genie takes a no-magic no-nonsense approach by doing things the Julia way: Controllers are plain Julia modules, Models leverage types and multiple dispatch, Genie apps are nothing but Julia projects, versioning and dependency management is provided by Julia's own Pkg, and code loading and reloading is automatically set up with Revise.

      Genie also takes inspiration from Julia's "start simple, grow as needed" philosophy, by allowing developers to bootstrap an app in the REPL or in a notebook, or easily create web services and APIs with just a few lines of code.

      As the projects grow more complex, Genie allows adding progressively more structure, by exposing a micro-framework which offers features like powerful routing, flexible logging, support for environments, view templates, etc.

      If database persistence is needed, support for Genie's ORM, SearchLight, can be added at any time. Finally, the full MVC structure can be used in order to develop and maintain more complex, end-to-end, web applications.

      +Welcome to Genie · Genie - The Highly Productive Julia Web Framework

      Welcome to Genie

      The Highly Productive Web Framework for Julia

      Genie is a full stack web framework for the Julia programming language. Genie's goals are: excellent developer productivity, great run-time performance, and best practices and security by default.

      The Genie web framework follows in the footsteps of mainstream full stack web frameworks like Ruby on Rails and Django, while staying 100% true to its Julia roots. Genie's architecture and development is inspired by the best features present in other frameworks, but not by their design. Genie takes a no-magic no-nonsense approach by doing things the Julia way: Controllers are plain Julia modules, Models leverage types and multiple dispatch, Genie apps are nothing but Julia projects, versioning and dependency management is provided by Julia's own Pkg, and code loading and reloading is automatically set up with Revise.

      Genie also takes inspiration from Julia's "start simple, grow as needed" philosophy, by allowing developers to bootstrap an app in the REPL or in a notebook, or easily create web services and APIs with just a few lines of code.

      As the projects grow more complex, Genie allows adding progressively more structure, by exposing a micro-framework which offers features like powerful routing, flexible logging, support for environments, view templates, etc.

      If database persistence is needed, support for Genie's ORM, SearchLight, can be added at any time. Finally, the full MVC structure can be used in order to develop and maintain more complex, end-to-end, web applications.

      diff --git a/dev/tutorials/10--Loading_Genie_Apps.html b/dev/tutorials/10--Loading_Genie_Apps.html index 4d64ee792..6e7cabaca 100644 --- a/dev/tutorials/10--Loading_Genie_Apps.html +++ b/dev/tutorials/10--Loading_Genie_Apps.html @@ -8,4 +8,4 @@ pkg> activate .

      Then, back to the julian prompt, run the following to load the Genie app:

      julia> using Genie
       
      -julia> Genie.loadapp()

      The app's environment will now be loaded.

      In order to start the web server execute

      julia> up()
      +julia> Genie.loadapp()

      The app's environment will now be loaded.

      In order to start the web server execute

      julia> up()
      diff --git a/dev/tutorials/11--Managing_External_Packages.html b/dev/tutorials/11--Managing_External_Packages.html index 29464f580..2bf45e39a 100644 --- a/dev/tutorials/11--Managing_External_Packages.html +++ b/dev/tutorials/11--Managing_External_Packages.html @@ -1,2 +1,2 @@ -Managing Genie app's dependencies · Genie - The Highly Productive Julia Web Framework

      Managing external packages for your Genie app

      Genie fully takes advantage of Julia's excellent package manager, Pkg – while allowing Genie developers to use any third party package available in Julia's ecosystem. This is achieved by taking a common sense approach: Genie apps are just plain Julia projects.

      In order to add extra packages to your Genie app, thus, we need to use Julia's Pkg features:

      1. start a Genie REPL with your app: $ bin/repl. This will automatically load the package environment of the app.
      2. switch to Pkg mode: julia> ]
      3. add the package you want, for example OhMyREPL: (MyGenieApp) pkg> add OhMyREPL

      That's all! Now you can use the packages at the Genie REPL or anywhere in your app via using or import.

      Use the same approach to update the packages in your app, via: pkg> up and apply all available updates, or pkg> up OhMyREPL to update a single package.

      +Managing Genie app's dependencies · Genie - The Highly Productive Julia Web Framework

      Managing external packages for your Genie app

      Genie fully takes advantage of Julia's excellent package manager, Pkg – while allowing Genie developers to use any third party package available in Julia's ecosystem. This is achieved by taking a common sense approach: Genie apps are just plain Julia projects.

      In order to add extra packages to your Genie app, thus, we need to use Julia's Pkg features:

      1. start a Genie REPL with your app: $ bin/repl. This will automatically load the package environment of the app.
      2. switch to Pkg mode: julia> ]
      3. add the package you want, for example OhMyREPL: (MyGenieApp) pkg> add OhMyREPL

      That's all! Now you can use the packages at the Genie REPL or anywhere in your app via using or import.

      Use the same approach to update the packages in your app, via: pkg> up and apply all available updates, or pkg> up OhMyREPL to update a single package.

      diff --git a/dev/tutorials/12--Advanced_Routing_Techniques.html b/dev/tutorials/12--Advanced_Routing_Techniques.html index 65ef6a120..43e54ce76 100644 --- a/dev/tutorials/12--Advanced_Routing_Techniques.html +++ b/dev/tutorials/12--Advanced_Routing_Techniques.html @@ -58,4 +58,4 @@ MethodError(convert, (Int64, "10"), 0x00000000000063fe) /customers/10/orders/20 404

      As you can see, Genie attempts to convert the types from the default SubString{String} to Int – but doesn't know how. It fails, can't find other matching routes and returns a 404 Not Found response.

      Type conversion in routes

      The error is easy to address though: we need to provide a type converter from SubString{String} to Int.

      Base.convert(::Type{Int}, v::SubString{String}) = parse(Int, v)

      Once we register the converter our request will be correctly handled, resulting in Order ID has type Int64 // Customer ID has type Int64

      Matching individual URI segments

      Besides matching the full route, Genie also allows matching individual URI segments. That is, enforcing that the various route parameters obey a certain pattern. In order to introduce constraints for route parameters we append #pattern at the end of the route parameter.

      Example

      For instance, let's assume that we want to implement a localized website where we have a URL structure like: mywebsite.com/en, mywebsite.com/es and mywebsite.com/de. We can define a dynamic route and extract the locale variable to serve localized content:

      route(":locale", TranslationsController.index)

      This will work very well, matching requests and passing the locale into our code within the payload(:locale) variable. However, it will also be too greedy, virtually matching all the requests, including things like static files (ie mywebsite.com/favicon.ico). We can constrain what the :locale variable can match, by appending the pattern (a regex pattern):

      route(":locale#(en|es|de)", TranslationsController.index)

      The refactored route only allows :locale to match one of en, es, and de strings.


      HEADS UP

      Keep in mind not to duplicate application logic. For instance, if you have an array of supported locales, you can use that to dynamically generate the pattern – routes can be fully dynamically generated!

      const LOCALE = ":locale#($(join(TranslationsController.AVAILABLE_LOCALES, '|')))"
       
      -route("/$LOCALE", TranslationsController.index, named = :get_index)

      The params collection

      It's good to know that the router bundles all the parameters of the current request into the params collection (a Dict{Symbol,Any}). This contains valuable information, such as route parameters, query params, POST payload, the original HTTP.Request and HTTP.Response objects, etcetera. In general it's recommended not to access the params collection directly but through the utility methods defined by Genie.Requests and Genie.Responses – but knowing about params might come in handy for advanced users.

      +route("/$LOCALE", TranslationsController.index, named = :get_index)

      The params collection

      It's good to know that the router bundles all the parameters of the current request into the params collection (a Dict{Symbol,Any}). This contains valuable information, such as route parameters, query params, POST payload, the original HTTP.Request and HTTP.Response objects, etcetera. In general it's recommended not to access the params collection directly but through the utility methods defined by Genie.Requests and Genie.Responses – but knowing about params might come in handy for advanced users.

      diff --git a/dev/tutorials/13--Initializers.html b/dev/tutorials/13--Initializers.html index 61424d8ec..5c288b2f1 100644 --- a/dev/tutorials/13--Initializers.html +++ b/dev/tutorials/13--Initializers.html @@ -1,2 +1,2 @@ -Auto-loading configuration code with initializers · Genie - The Highly Productive Julia Web Framework

      Customized application configuration with initializers

      Initializers are plain Julia files which are loaded early in the application life-cycle (before routes, controller, or models). They are designed to implement configuration code which is used by other parts of the application (like database connections, logging settings, etc).

      Initializers should be placed within the config/initializers/ folder and they will be automatically loaded by Genie into the app.

      If your configuration is environment dependent (like a database connection which is different between dev and prod environments), it should be added to the corresponding config/env/*.jl file.

      Best practices

      • You can name the initializers as you wish (ideally a descriptive name, like redis.jl for connecting to a Redis DB).
      • Don't use uppercase names unless you define a module (in order to respect Julia's naming practices).
      • Keep your initializer files small and focused, so they serve only one purpose.
      • You can add as many initializers as you need.
      • Do not abuse them, they are not meant to host complex code - app logic should be in models and controllers.

      Load order

      The initializers are loaded in the order they are read from the file system. If you have initializers which depend on other initializers, this is most likely a sign that you need to refactor using a model or a library file.


      HEADS UP

      Library files are Julia files which provide distinct functionality and can be placed in the lib/ folder where they are also automatically loaded by Genie. If the lib/ folder does not exist, you can create it yourself.


      Scope

      All the definitions (variables, constants, functions, modules, etc) added to initializer files are loaded into your app's module. So if your app is called MyGenieApp, the definitions will be available under the MyGenieApp module.


      HEADS UP

      Given that your app's name is variable, you can also access your app's module through the Main.UserApp constant. So all the definitions added to initializers can also be accessed through the Main.UserApp module.


      +Auto-loading configuration code with initializers · Genie - The Highly Productive Julia Web Framework

      Customized application configuration with initializers

      Initializers are plain Julia files which are loaded early in the application life-cycle (before routes, controller, or models). They are designed to implement configuration code which is used by other parts of the application (like database connections, logging settings, etc).

      Initializers should be placed within the config/initializers/ folder and they will be automatically loaded by Genie into the app.

      If your configuration is environment dependent (like a database connection which is different between dev and prod environments), it should be added to the corresponding config/env/*.jl file.

      Best practices

      • You can name the initializers as you wish (ideally a descriptive name, like redis.jl for connecting to a Redis DB).
      • Don't use uppercase names unless you define a module (in order to respect Julia's naming practices).
      • Keep your initializer files small and focused, so they serve only one purpose.
      • You can add as many initializers as you need.
      • Do not abuse them, they are not meant to host complex code - app logic should be in models and controllers.

      Load order

      The initializers are loaded in the order they are read from the file system. If you have initializers which depend on other initializers, this is most likely a sign that you need to refactor using a model or a library file.


      HEADS UP

      Library files are Julia files which provide distinct functionality and can be placed in the lib/ folder where they are also automatically loaded by Genie. If the lib/ folder does not exist, you can create it yourself.


      Scope

      All the definitions (variables, constants, functions, modules, etc) added to initializer files are loaded into your app's module. So if your app is called MyGenieApp, the definitions will be available under the MyGenieApp module.


      HEADS UP

      Given that your app's name is variable, you can also access your app's module through the Main.UserApp constant. So all the definitions added to initializers can also be accessed through the Main.UserApp module.


      diff --git a/dev/tutorials/14--The_Secrets_File.html b/dev/tutorials/14--The_Secrets_File.html index ab4faf0ca..ed35e6c60 100644 --- a/dev/tutorials/14--The_Secrets_File.html +++ b/dev/tutorials/14--The_Secrets_File.html @@ -1,2 +1,2 @@ -The secrets file · Genie - The Highly Productive Julia Web Framework

      The secrets (config/secrets.jl) file

      Confidential configuration data (like API keys, usernames, passwords, etc) should be added to the config/secrets.jl file. This file is by default added to .gitignore when creating a Genie app, so it won't be added to source control – to avoid that it is accidentally exposed.

      Scope

      All the definitions (variables, constants, functions, modules, etc) added to the secrets.jl file are loaded into your app's module. So if your app (and its main module) is called MyGenieApp, the definitions will be available under the MyGenieApp namespace.


      HEADS UP

      Given the your app's name is variable, you can also access your app's module through the Main.UserApp constant. So all the definitions added to secrets.jl can also be accessed through the Mani.UserApp module.


      +The secrets file · Genie - The Highly Productive Julia Web Framework

      The secrets (config/secrets.jl) file

      Confidential configuration data (like API keys, usernames, passwords, etc) should be added to the config/secrets.jl file. This file is by default added to .gitignore when creating a Genie app, so it won't be added to source control – to avoid that it is accidentally exposed.

      Scope

      All the definitions (variables, constants, functions, modules, etc) added to the secrets.jl file are loaded into your app's module. So if your app (and its main module) is called MyGenieApp, the definitions will be available under the MyGenieApp namespace.


      HEADS UP

      Given the your app's name is variable, you can also access your app's module through the Main.UserApp constant. So all the definitions added to secrets.jl can also be accessed through the Mani.UserApp module.


      diff --git a/dev/tutorials/15--The_Lib_Folder.html b/dev/tutorials/15--The_Lib_Folder.html index 44e299db2..95f80fe10 100644 --- a/dev/tutorials/15--The_Lib_Folder.html +++ b/dev/tutorials/15--The_Lib_Folder.html @@ -1,2 +1,2 @@ -Auto-loading user libraries · Genie - The Highly Productive Julia Web Framework

      The lib/ folder

      Genie makes it easy to automatically load Julia code (modules, files, etc) into an app, outside of the standard Genie MVC app structure. You simply need to add your files and folders into the lib/ folder.


      HEADS UP

      • If the lib/ folder does not exist, just create it yourself: julia> mkdir("lib")
      • Genie includes the files placed within the lib/ folder and subfolders recursively
      • Files within lib/ are loaded using Revise and are automatically reloaded if changed.

      +Auto-loading user libraries · Genie - The Highly Productive Julia Web Framework

      The lib/ folder

      Genie makes it easy to automatically load Julia code (modules, files, etc) into an app, outside of the standard Genie MVC app structure. You simply need to add your files and folders into the lib/ folder.


      HEADS UP

      • If the lib/ folder does not exist, just create it yourself: julia> mkdir("lib")
      • Genie includes the files placed within the lib/ folder and subfolders recursively
      • Files within lib/ are loaded using Revise and are automatically reloaded if changed.

      diff --git a/dev/tutorials/16--Using_Genie_With_Docker.html b/dev/tutorials/16--Using_Genie_With_Docker.html index 9bc2e26c1..9952720df 100644 --- a/dev/tutorials/16--Using_Genie_With_Docker.html +++ b/dev/tutorials/16--Using_Genie_With_Docker.html @@ -33,4 +33,4 @@ PACKAGES, sysimage_path = "compiled/sysimg.so", cpu_target = PackageCompiler.default_app_cpu_target() -)

      Using the precompiled image

      The result of these changes is that PackageCompiler will create a new Julia sysimage that will be stored inside the compiled/sysimg.so file. The last step is to instruct our bin/server script to use the image.

      Edit the bin/server file and make it look like this:

      julia --color=yes --depwarn=no --project=@. --sysimage=compiled/sysimg.so -q -i -- $(dirname $0)/../bootstrap.jl -s=true "$@"

      With this change we're passing the additional --sysimage flag, indicating our new Julia sys image.

      +)

      Using the precompiled image

      The result of these changes is that PackageCompiler will create a new Julia sysimage that will be stored inside the compiled/sysimg.so file. The last step is to instruct our bin/server script to use the image.

      Edit the bin/server file and make it look like this:

      julia --color=yes --depwarn=no --project=@. --sysimage=compiled/sysimg.so -q -i -- $(dirname $0)/../bootstrap.jl -s=true "$@"

      With this change we're passing the additional --sysimage flag, indicating our new Julia sys image.

      diff --git a/dev/tutorials/17--Working_with_Web_Sockets.html b/dev/tutorials/17--Working_with_Web_Sockets.html index 3b86ab95f..9c9bb65be 100644 --- a/dev/tutorials/17--Working_with_Web_Sockets.html +++ b/dev/tutorials/17--Working_with_Web_Sockets.html @@ -32,4 +32,4 @@ end

      Now if you reload the page and broadcast the message, it will be picked up by our custom payload handler.

      We can remove clients that are no longer reachable (for instance, if the browser tab is closed) with:

      julia> Genie.WebChannels.unsubscribe_disconnected_clients()

      The output of unsubscribe_disconnected_clients() is the collection of remaining (connected) clients.


      Heads up!

      You should routinely unsubscribe_disconnected_clients() to free memory.


      At any time, we can check the connected clients with Genie.WebChannels.connected_clients() and the disconnected ones with Genie.WebChannels.disconnected_clients().

      Pushing messages from the client

      We can also push messages from client to server. As we don't have a UI, we'll use the browser's console and Genie's JavaScript API to send the messages. But first, we need to set up the channel which will receive our message. Run this in the active Julia REPL:

      channel("/____/echo") do
         @info "Received: $(params(:payload))"
       end

      Now that our endpoint is up, go to the browser's console and run:

      Genie.WebChannels.sendMessageTo('____', 'echo', 'Hello!')

      The julia terminal and console will both immediately display the response from the server:

      Received: Hello!
      -Got this payload: Received: Hello!

      Summary

      This concludes our intro to working with WebSockets in Genie. You now have the knowledge to set up the communication between client and server, send messages from both server and clients, and perform various tasks using the WebChannels API.

      +Got this payload: Received: Hello!

      Summary

      This concludes our intro to working with WebSockets in Genie. You now have the knowledge to set up the communication between client and server, send messages from both server and clients, and perform various tasks using the WebChannels API.

      diff --git a/dev/tutorials/2--Installing_Genie.html b/dev/tutorials/2--Installing_Genie.html index b3d12858d..f841510c1 100644 --- a/dev/tutorials/2--Installing_Genie.html +++ b/dev/tutorials/2--Installing_Genie.html @@ -1,2 +1,2 @@ -Installing Genie · Genie - The Highly Productive Julia Web Framework

      How to Install Genie

      Install Genie from Julia's registry – for example the latest version (currently version 5):

      pkg> add Genie

      Genie, just like Julia, uses semantic versioning in the form vX.Y.Z to designate:

      • X : major version, introducing breaking changes
      • Y : minor version, brings new features, no breaking changes
      • Z : patch version, fixes bugs, no new features or breaking changes
      +Installing Genie · Genie - The Highly Productive Julia Web Framework

      How to Install Genie

      Install Genie from Julia's registry – for example the latest version (currently version 5):

      pkg> add Genie

      Genie, just like Julia, uses semantic versioning in the form vX.Y.Z to designate:

      • X : major version, introducing breaking changes
      • Y : minor version, brings new features, no breaking changes
      • Z : patch version, fixes bugs, no new features or breaking changes
      diff --git a/dev/tutorials/3--Getting_Started.html b/dev/tutorials/3--Getting_Started.html index 90e912f22..27316568e 100644 --- a/dev/tutorials/3--Getting_Started.html +++ b/dev/tutorials/3--Getting_Started.html @@ -19,4 +19,4 @@ respond("Hello World", :text) end -up(8001, async = false)

      We begun by defining 2 routes and we used the html and json rendering functions (available in the Renderer.Html and the Renderer.Json modules). These functions are responsible for outputting the data using the correct format and document type (with the correct MIME), in our case HTML data for hello.html, and JSON data for hello.json.

      The third route serves text responses. As Genie does not provide a specialized text() method for sending text/plain responses, we use the generic respond function, indicating the desired MIME type. In our case :text, corresponding to text/plain. Other available MIME types shortcuts are :xml, :markdown, :javascript and a few others others – and users can register their own mime types and response types as needed or can pass the full mime type as a string, ie "text/csv".

      The up function will launch the web server on port 8001. This time, very important, we instructed it to start the server synchronously (that is, blocking the execution of the script), by passing the async = false argument. This way we make sure that our script stays running. Otherwise, at the end of the script, the Julia process would normally exit, killing our server.

      In order to launch the script, run $ julia geniews.jl.

      Batteries included

      Genie readily makes available a rich set of features - you have already seen the rendering and the routing modules in action. But for instance, logging (to file and console) can also be easily triggered with one line of code, powerful caching can be enabled with a couple more lines, and so on.

      The app already handles "404 Page Not Found" and "500 Internal Error" responses. If you try to access a URL which is not handled by the app, like say http://127.0.0.1:8001/not_here, you'll see Genie's default 404 page. The default error pages can be overwritten with custom ones.

      +up(8001, async = false)

      We begun by defining 2 routes and we used the html and json rendering functions (available in the Renderer.Html and the Renderer.Json modules). These functions are responsible for outputting the data using the correct format and document type (with the correct MIME), in our case HTML data for hello.html, and JSON data for hello.json.

      The third route serves text responses. As Genie does not provide a specialized text() method for sending text/plain responses, we use the generic respond function, indicating the desired MIME type. In our case :text, corresponding to text/plain. Other available MIME types shortcuts are :xml, :markdown, :javascript and a few others others – and users can register their own mime types and response types as needed or can pass the full mime type as a string, ie "text/csv".

      The up function will launch the web server on port 8001. This time, very important, we instructed it to start the server synchronously (that is, blocking the execution of the script), by passing the async = false argument. This way we make sure that our script stays running. Otherwise, at the end of the script, the Julia process would normally exit, killing our server.

      In order to launch the script, run $ julia geniews.jl.

      Batteries included

      Genie readily makes available a rich set of features - you have already seen the rendering and the routing modules in action. But for instance, logging (to file and console) can also be easily triggered with one line of code, powerful caching can be enabled with a couple more lines, and so on.

      The app already handles "404 Page Not Found" and "500 Internal Error" responses. If you try to access a URL which is not handled by the app, like say http://127.0.0.1:8001/not_here, you'll see Genie's default 404 page. The default error pages can be overwritten with custom ones.

      diff --git a/dev/tutorials/4--Developing_Web_Services.html b/dev/tutorials/4--Developing_Web_Services.html index b9db492a9..917d932ad 100644 --- a/dev/tutorials/4--Developing_Web_Services.html +++ b/dev/tutorials/4--Developing_Web_Services.html @@ -13,4 +13,4 @@ ├── src └── test

      These are the roles of each of the files and folders:


      HEADS UP

      After creating a new app you might need to change the file permissions to allow editing/saving the files such as routes.jl.


      Adding logic

      You can now edit the routes.jl file to add some logic, at the bottom of the file:

      route("/hello") do
         "Welcome to Genie!"
      -end

      If you now visit http://127.0.0.1:8000/hello you'll see a warm greeting.

      Extending the app

      Genie apps are just plain Julia projects. This means that routes.jl will behave like any other Julia script - you can reference extra packages, you can switch into pkg> mode to manage per project dependencies, include other files, etcetera.

      If you have existing Julia code that you want to quickly load into a Genie app, you can add a lib/ folder in the root of the app and place your Julia files there. If the folder exists, lib/ and all its subfolders are automatically loaded by Genie, recursively.


      WARNING

      If you add the lib/ folder while the Genie app is running, you will need to restart the app to load the files.


      If you need to add database support, you can always add the SearchLight ORM by running julia> Genie.Generator.db_support() in the app's REPL.

      However, if your app grows in complexity and you develop it from scratch, it is more efficient to take advantage of Genie's resource-oriented MVC structure.

      +end

      If you now visit http://127.0.0.1:8000/hello you'll see a warm greeting.

      Extending the app

      Genie apps are just plain Julia projects. This means that routes.jl will behave like any other Julia script - you can reference extra packages, you can switch into pkg> mode to manage per project dependencies, include other files, etcetera.

      If you have existing Julia code that you want to quickly load into a Genie app, you can add a lib/ folder in the root of the app and place your Julia files there. If the folder exists, lib/ and all its subfolders are automatically loaded by Genie, recursively.


      WARNING

      If you add the lib/ folder while the Genie app is running, you will need to restart the app to load the files.


      If you need to add database support, you can always add the SearchLight ORM by running julia> Genie.Generator.db_support() in the app's REPL.

      However, if your app grows in complexity and you develop it from scratch, it is more efficient to take advantage of Genie's resource-oriented MVC structure.

      diff --git a/dev/tutorials/4-1--Developing_MVC_Web_Apps.html b/dev/tutorials/4-1--Developing_MVC_Web_Apps.html index e6bb67eec..f2c3b9d27 100644 --- a/dev/tutorials/4-1--Developing_MVC_Web_Apps.html +++ b/dev/tutorials/4-1--Developing_MVC_Web_Apps.html @@ -203,4 +203,4 @@ h1("Welcome Admin") |> html end -end

      If we navigate to http://127.0.0.1:8000/admin/movies we'll be asked to logged in. Using admin for the user and admin for the password will allow us to access the password protected section.

      +end

      If we navigate to http://127.0.0.1:8000/admin/movies we'll be asked to logged in. Using admin for the user and admin for the password will allow us to access the password protected section.

      diff --git a/dev/tutorials/5--Handling_Query_Params.html b/dev/tutorials/5--Handling_Query_Params.html index b9c91ab09..82f5617bf 100644 --- a/dev/tutorials/5--Handling_Query_Params.html +++ b/dev/tutorials/5--Handling_Query_Params.html @@ -9,4 +9,4 @@ route("/hi") do "Hello $(getpayload(:name, "Anon"))" -end

      The getpayload function has a few specializations, and one of them accepts the key and a default value. The default value is returned if the key variable is not defined. You can see the various implementations for getpayload using the API docs or Julia's help> mode.

      +end

      The getpayload function has a few specializations, and one of them accepts the key and a default value. The default value is returned if the key variable is not defined. You can see the various implementations for getpayload using the API docs or Julia's help> mode.

      diff --git a/dev/tutorials/6--Working_with_POST_Payloads.html b/dev/tutorials/6--Working_with_POST_Payloads.html index 7a16893d9..8e8068e57 100644 --- a/dev/tutorials/6--Working_with_POST_Payloads.html +++ b/dev/tutorials/6--Working_with_POST_Payloads.html @@ -16,4 +16,4 @@ "Hello $(postpayload(:name, "Anon"))" end -up()

      The postpayload function has a few specializations, and one of them accepts the key and the default value. The default value is returned if the key variable is not defined. You can see the various implementations for postpayload using the API docs or Julia's help> mode.

      +up()

      The postpayload function has a few specializations, and one of them accepts the key and the default value. The default value is returned if the key variable is not defined. You can see the various implementations for postpayload using the API docs or Julia's help> mode.

      diff --git a/dev/tutorials/7--Using_JSON_Payloads.html b/dev/tutorials/7--Using_JSON_Payloads.html index 219e550b4..1e4eb1a82 100644 --- a/dev/tutorials/7--Using_JSON_Payloads.html +++ b/dev/tutorials/7--Using_JSON_Payloads.html @@ -21,4 +21,4 @@ Content-Type: application/json Transfer-Encoding: chunked -"Hello Adrian""""

      First, for the two @show calls, notice how jsonpayload had successfully converted the POST data to a Dict. While the rawpayload returns the POST data as a String, exactly as received. Finally, our route handler returns a JSON response, greeting the user by extracting the name from within the jsonpayload Dict.

      +"Hello Adrian""""

      First, for the two @show calls, notice how jsonpayload had successfully converted the POST data to a Dict. While the rawpayload returns the POST data as a String, exactly as received. Finally, our route handler returns a JSON response, greeting the user by extracting the name from within the jsonpayload Dict.

      diff --git a/dev/tutorials/8--Handling_File_Uploads.html b/dev/tutorials/8--Handling_File_Uploads.html index 27aa7c452..f53b35e7d 100644 --- a/dev/tutorials/8--Handling_File_Uploads.html +++ b/dev/tutorials/8--Handling_File_Uploads.html @@ -22,4 +22,4 @@ end end -up()

      Upon uploading a file and submitting the form, our app will display the file's stats.

      +up()

      Upon uploading a file and submitting the form, our app will display the file's stats.

      diff --git a/dev/tutorials/9--Publishing_Your_Julia_Code_Online_With_Genie_Apps.html b/dev/tutorials/9--Publishing_Your_Julia_Code_Online_With_Genie_Apps.html index ac83bc438..6d4bbfa71 100644 --- a/dev/tutorials/9--Publishing_Your_Julia_Code_Online_With_Genie_Apps.html +++ b/dev/tutorials/9--Publishing_Your_Julia_Code_Online_With_Genie_Apps.html @@ -14,4 +14,4 @@ route("/friday") do MyLib.isitfriday() ? "Yes, it's Friday!" : "No, not yet :(" -end

      Use the lib/ folder to host your Julia code so that Genie knows where to look in order to load it and make it available throughout the application.

      +end

      Use the lib/ folder to host your Julia code so that Genie knows where to look in order to load it and make it available throughout the application.

      diff --git a/dev/tutorials/90--Deploying_With_Heroku_Buildpacks.html b/dev/tutorials/90--Deploying_With_Heroku_Buildpacks.html index 3119918df..40f9ba21f 100644 --- a/dev/tutorials/90--Deploying_With_Heroku_Buildpacks.html +++ b/dev/tutorials/90--Deploying_With_Heroku_Buildpacks.html @@ -6,4 +6,4 @@ origin https://github.com/milesfrain/GenieOnHeroku.git (fetch) origin https://github.com/milesfrain/GenieOnHeroku.git (push)

      We are using a buildpack for Julia. This runs many of the common deployment operations required for Julia projects. It relies on the directory layout found in the example project, with Project.toml, Manifest.toml in the root, and all Julia code in the src directory.

      Deploy your app

      git push heroku master

      This pushes your current branch of your local repo to the heroku remote repo's master branch.

      Heroku will automatically execute the commands described in the Julia buildpack and Procfile of this latest push.

      You must push to the heroku master branch to trigger an automated deploy.

      Open your app's webpage

      heroku open -a $HEROKU_APP_NAME

      This is a convenience command to open your app's webpage in your browser.

      The webpage is: https://$HEROKU_APP_NAME.herokuapp.com/

      For example: https://my-app-name.herokuapp.com/

      View app logs

      heroku logs -tail -a $HEROKU_APP_NAME

      This is another convenience command to launch a log viewer that remains open to show the latest status of your app.

      The println statements from Julia will also appear here.

      Exit this viewer with Ctrl-C.

      Logs can also be viewed from the Heroku web dashboard. For example: https://dashboard.heroku.com/apps/my-app-name/logs

      Deploy app updates changes

      To deploy any changes made to your app, simply commit those changes locally, and re-push to heroku.

      <make changes>
       git commit -am "my commit message"
      -git push heroku master
      +git push heroku master diff --git a/dev/tutorials/92--Deploying_Genie_Server_Apps_with_Nginx.html b/dev/tutorials/92--Deploying_Genie_Server_Apps_with_Nginx.html index ea0588e3e..c600aeec2 100644 --- a/dev/tutorials/92--Deploying_Genie_Server_Apps_with_Nginx.html +++ b/dev/tutorials/92--Deploying_Genie_Server_Apps_with_Nginx.html @@ -29,4 +29,4 @@ } }

      directly from the server public IP.

      served by nginx. These are needed when the server_handle_static_file is set to false in the Genie app settings.

      To make that config effective, it needs to be present in sites-enabled. The default config can be removed.

      sudo ln -s /etc/nginx/sites-available/my-genie-app /etc/nginx/sites-enabled/my-genie-app

      Then restart the server to make changes effective:

      sudo systemctl restart nginx

      Enable HTTPS

      To enable HTTPS, a site-certificate will be needed for the domain on which the site will be served. A practical approach is to use the utilities provided by certbot.

      Following provided instructions for nginx on Ubuntu 20.04:

      sudo snap install core; sudo snap refresh core
       sudo snap install --classic certbot
      -sudo ln -s /snap/bin/certbot /usr/bin/certbot

      Then, using certbot utility, a certificate will be generated and appropriate modification to nginx config will be brought to handle support for HTTPS:

      sudo certbot --nginx

      Note that this step will check for ownernship of the test.com domain mentionned in the nginx config file. For that validation to succeed, it requires to have the A record for the domain set to 123.123.123.123.

      +sudo ln -s /snap/bin/certbot /usr/bin/certbot

      Then, using certbot utility, a certificate will be generated and appropriate modification to nginx config will be brought to handle support for HTTPS:

      sudo certbot --nginx

      Note that this step will check for ownernship of the test.com domain mentionned in the nginx config file. For that validation to succeed, it requires to have the A record for the domain set to 123.123.123.123.

      diff --git a/dev/tutorials/93--Deploying_Genie_Using_A_Process_Control_System.html b/dev/tutorials/93--Deploying_Genie_Using_A_Process_Control_System.html index 17fe141ac..38d4aee50 100644 --- a/dev/tutorials/93--Deploying_Genie_Using_A_Process_Control_System.html +++ b/dev/tutorials/93--Deploying_Genie_Using_A_Process_Control_System.html @@ -16,4 +16,4 @@ stopwaitsecs=3600

      Now the application is almost ready to start just need to configure the secret token. Go into the project directory and execute the following command. It will generate secrets.jl inside config/secrets.jl file and if it exists then it will update with a new token string.

      julia --project=. --banner=no --eval="using Pkg; using Genie; Genie.Generator.write_secrets_file()"

      Then set the GENIE_ENV environment variable to prod:

      export GENIE_ENV=prod

      To launch the app few things need to do before starting process control.

      Create symbolic link to supervisor config directory

      cd /etc/supervisor/conf.d/
       sudo ln -s /PATH TO THE SUPERVISOR.CONF FILE
       sudo /etc/init.d/supervisor reload

      Few assumption about installation instruction

      If thing not working then you may check following things.

      (1) check the sudo systemctl status supervisor.service service is working or not. if not working then you can start and enable for the start up using following command

      sudo systemctl enable supervisor.service
      -sudo systemctl start supervisor.service

      and then check if status is active or still has any issue.

      (2) You can check the application log by tail to log file as bellow

      tail -f /var/log/genie-application.log

      in this log you will find the genie logs.

      (3) Make sure whatever port you used inside GENIE_ENV config file at server_port must be open in at firewall and no other process is bind to it.

      Check weather the any process is running at port 80 for an example use following command

      sudo lsof -t -i:80

      If you want to kill the process which is running at port 80 you can use single liner magic command

      if sudo lsof -t -i:80; then sudo kill -9 $(sudo lsof -t -i:80); fi
      +sudo systemctl start supervisor.service

      and then check if status is active or still has any issue.

      (2) You can check the application log by tail to log file as bellow

      tail -f /var/log/genie-application.log

      in this log you will find the genie logs.

      (3) Make sure whatever port you used inside GENIE_ENV config file at server_port must be open in at firewall and no other process is bind to it.

      Check weather the any process is running at port 80 for an example use following command

      sudo lsof -t -i:80

      If you want to kill the process which is running at port 80 you can use single liner magic command

      if sudo lsof -t -i:80; then sudo kill -9 $(sudo lsof -t -i:80); fi