-
Genie.serve โ€” Function.
serve(path::String = DOC_ROOT_PATH, 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 Flax 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.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.websocket_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, "0.0.0.0", async = false)
[ Info: Ready!
Web Server starting at http://0.0.0.0:8000
source
Genie.newmodel โ€” Function.
newmodel(model_name::String; context = @__MODULE__) :: Nothing

Creates a new SearchLight model file.

source
Genie.newcontroller โ€” Function.
newcontroller(controller_name::String) :: 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::String; pluralize::Bool = true, context::Module = @__MODULE__) :: 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.newmigration โ€” Function.
newmigration(migration_name::String, context::Module = @__MODULE__) :: Nothing

Creates a new SearchLight migration file.

source
Genie.newtablemigration โ€” Function.
newtablemigration(migration_name::String) :: Nothing

Creates a new migration prefilled with code for creating a new table.

source
Genie.newtask โ€” Function.
newtask(task_name::String) :: Nothing

Creates a new Genie Task file.

source