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 serverparams
: additional arguments which are passed toGenie.startup
to control the web serverkwparams
: additionak keyword arguments which are passed toGenie.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
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 itautostart::Bool
: automatically start the app once the file structure is createdfullstack::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 ORMmvcsupport::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
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
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 serverhost::String
: the host used by the web serverws_port::Int
: the port used by the Web Sockets serverasync::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
Genie.newmodel
โ Function.newmodel(model_name::String; context = @__MODULE__) :: Nothing
Creates a new SearchLight model
file.
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.
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.
Genie.newmigration
โ Function.newmigration(migration_name::String, context::Module = @__MODULE__) :: Nothing
Creates a new SearchLight migration file.
Genie.newtablemigration
โ Function.newtablemigration(migration_name::String) :: Nothing
Creates a new migration prefilled with code for creating a new table.
Genie.newtask
โ Function.newtask(task_name::String) :: Nothing
Creates a new Genie Task
file.