Genie Discord forum

Author AvatarCameron Pfiffer
9/7/2023, 2:14:15 PM

I've been doing a bunch of dev on a Genie backend. It's pretty simple stuff, just a bunch of route calls and some backend logic.

Is there a way to reload the server without killing my Julia session? Or to have it monitor the backend code/routes for changes?

Author AvatarPere
9/7/2023, 2:24:30 PM

Genie uses Revise.jl to handle code reloading. For instance, if you're including your routes with an includestatement, hotreloading won't work.

Can you share a MWE where reloading doesn't work and I'll help you out?

Author AvatarCameron Pfiffer
9/10/2023, 5:39:20 PM

Ah, so I need to just wrap my code in modules?

Author AvatarPere
9/12/2023, 1:07:35 PM

You can manually set Revise to reload code, or call Genie.autoload to watch some files. Moreover, if you define your routes in the routes.jl file in the root, any changes made to it will be automatically reloaded. The routes.jl file is one of the ones automatically watched when launching a Genie app. Note that routes.jl should not be enclosed in a module.