Genie Discord forum

Hello, how can I use Genie Builder together with Genie authentication? Which steps are required to setup the database connection?

install SearchLight.jl Package

follow these steps, you will see a new folder db which has a file configuration.yml


first add db

then use genieauthentication as per guidelines on website

Hello, thanks for the quick reply! Unfortunately, I get an error running SearchLight.Generator.newconfig(). I did the following: I generated a new app using Genie builder called auth_test. Then, I used SearchLight.Generator.newconfig() as stated by you. What can I do to make it running?


@Juliane Müller-Sielaff I'm not familiar with the authentication module yet, but I can try to explain how to use the DB. I'll soon do a tutorial about this; if you need any more help please ask
in this repo 1 we have a demo of an app working with a database. You first have to create a connection.yml file in the db/ folder, and then connect to the db with SearchLight.Configuration.load() |> SearchLight.connect
In createdb.jl you'll find the steps to work with a db as:
- connect to a sqlite db
- generate the migration and module files for a new resource
- edit the migration file with the table schema for the resource
- define in the resource module in app/resources/ the resource struct matching the table schema
- execute the migration to create the table
- seed the table with some initial data
1https://github.com/GenieFramework/GenieFrameworkDemos_NewAPI/tree/main/Database

I am currently working on GenieAuthentication. I'll be able to help you on this day after tomorrow
short answer is currently it's not straight forward to use GAuth with GenieBuilder

Hello, I found a solution by myself 🙂
- create the Genie Builder App
- Create database similar to: https://docs.juliahub.com/Genie/8eazC/1.3.0/guides/Working_With_Genie_Apps.html#Accessing-databases-with-SearchLight-models
- follow the GenieAuthentication instructions: https://github.com/GenieFramework/GenieAuthentication.jl
- Remove lines with „output_flash“ from html files in app/resources/authentication/views and AuthenticationController.jl
- Add following to app.jl :
- @page("/login", "app/resources/authentication/views/login.jl.html")
- @page("/register", "app/resources/authentication/views/register.jl.html")
- @page("/success", "app/resources/authentication/views/success.jl.html")
Then, it works 🙂

@Juliane Müller-Sielaff question. How are you authenticating
a route? You didn't post that logic
route("/protected_route", MyController.index)
module MyController
function index
authenticated!()
render_html
end