Genie.serve โ€” Function
serve(path::String = Genie.config.server_document_root, 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.startup().

Arguments

  • path::String: the folder of static files to be served by the server
  • params: additional arguments which are passed to Genie.startup to control the web server
  • kwparams: additionak keyword arguments which are passed to Genie.startup 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
Genie.newapp โ€” Function
newapp(path::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

  • path::String: the name of the app and the path where to bootstrap it
  • 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

Examples

julia> Genie.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
 Resolving package versions...
  Updating `~/Dropbox/Projects/GenieTests/MyGenieApp/Project.toml`
  [c43c736e] + Genie v0.10.1
  Updating `~/Dropbox/Projects/GenieTests/MyGenieApp/Manifest.toml`

2019-08-06 16:54:27:INFO:Main: Starting your brand new Genie app - hang tight!
 _____         _
|   __|___ ___|_|___
|  |  | -_|   | | -_|
|_____|___|_|_|_|___|

โ”Œ Info:
โ”‚ Starting Genie in >> DEV << mode
โ””
[ 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.newapp_webservice โ€” Function
newapp_webservice(path::String = "."; autostart::Bool = true, dbsupport::Bool = false) :: Nothing

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

Arguments

  • path::String: the name of the app and the path where to bootstrap it
  • 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
source
Genie.newapp_mvc โ€” Function
newapp_mvc(path::String = "."; autostart::Bool = true) :: Nothing

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

Arguments

  • path::String: the name of the app and the path where to bootstrap it
  • autostart::Bool: automatically start the app once the file structure is created
source
Genie.newapp_fullstack โ€” Function
newapp_fullstack(path::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

  • path::String: the name of the app and the path where to bootstrap it
  • autostart::Bool: automatically start the app once the file structure is created
source
Genie.loadapp โ€” Function
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
โ”œโ”€โ”€ bin
โ”œโ”€โ”€ bootstrap.jl
โ”œโ”€โ”€ config
โ”œโ”€โ”€ env.jl
โ”œโ”€โ”€ genie.jl
โ”œโ”€โ”€ log
โ”œโ”€โ”€ public
โ”œโ”€โ”€ routes.jl
โ””โ”€โ”€ src

5 directories, 6 files

julia> using Genie

julia> Genie.loadapp(".")
 _____         _
|   __|___ ___|_|___
|  |  | -_|   | | -_|
|_____|___|_|_|_|___|

โ”Œ Info:
โ”‚ Starting Genie in >> DEV << mode
โ””
[ Info: Logging to file at MyGenieApp/log/dev.log
source
Genie.startup โ€” Function
startup(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 AppServer.startup

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> startup(8000, "127.0.0.1", async = false)
[ Info: Ready!
Web Server starting at http://127.0.0.1:8000
source
Genie.up โ€” Function
startup(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.down โ€” Function
down(; webserver::Bool = true, websockets::Bool = true) :: ServersCollection

Shuts down the servers optionally indicating which of the webserver and websockets servers to be stopped.

source
Genie.run โ€” Function
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.newcontroller โ€” Function
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
Genie.newresource โ€” Function
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
Genie.newtask โ€” Function
newtask(task_name::Union{String,Symbol}) :: Nothing

Creates a new Genie Task file.

source
Genie.load_libs โ€” Function
load_libs(root_dir::String = Genie.config.path_lib) :: Nothing

Recursively adds subfolders of lib/ to LOAD_PATH. The lib/ folder, if present, is designed to host user code in the form of .jl files. This function loads user code into the Genie app.

source
Genie.load_resources โ€” Function
load_resources(root_dir::String = Genie.config.path_resources) :: Nothing

Recursively adds subfolders of resources/ to LOAD_PATH.

source
Genie.load_helpers โ€” Function
load_helpers(root_dir::String = Genie.config.path_helpers) :: Nothing

Recursively adds subfolders of helpers/ to LOAD_PATH.

source
Genie.load_configurations โ€” Function
load_configurations(root_dir::String = Genie.config.path_config; context::Union{Module,Nothing} = nothing) :: Nothing

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

source
Genie.load_initializers โ€” Function
load_initializers(root_dir::String = Genie.config.path_config; context::Union{Module,Nothing} = nothing) :: Nothing

Loads (includes) the framework's initializers. The files are set up with Revise to be automatically reloaded.

source
Genie.load_plugins โ€” Function
load_plugins(root_dir::String = Genie.config.path_plugins; context::Union{Module,Nothing} = nothing) :: Nothing

Loads (includes) the framework's plugins initializers.

source
Genie.load_routes_definitions โ€” Function
load_routes_definitions(routes_file::String = Genie.ROUTES_FILE_NAME; context::Union{Module,Nothing} = nothing) :: Nothing

Loads the routes file.

source
Genie.secret_token โ€” Function
secret_token(; context::Union{Module,Nothing} = nothing) :: String

Wrapper around /config/secrets.jl SECRET_TOKEN const. Sets up the secret token used in the app for encryption and salting. If there isn't a valid secrets file, a temporary secret token is generated for the current session only.

source
Genie.default_context โ€” Function
default_context(context::Union{Module,Nothing})

Sets the module in which the code is loaded (the app's module)

source
Genie.load โ€” Function
load(; context::Union{Module,Nothing} = nothing) :: Nothing

Main entry point to loading a Genie app.

source
Genie.replprint โ€” Function
replprint(output::String, terminal;
                newline::Int = 0, clearline::Int = 1, color::Symbol = :white, bold::Bool = false, sleep_time::Float64 = 0.2,
                prefix::String = "", prefix_color::Symbol = :green, prefix_bold::Bool = true)

Prints app loading progress to the console.

source