Genie Discord forum

Author AvatarJuliane Müller-Sielaff
2/8/2023, 11:10:33 AM

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

Author Avatarkungfupanda007
2/9/2023, 5:07:08 AM

install SearchLight.jl Package

Author Avatarkungfupanda007
2/9/2023, 5:12:54 AM

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

Author Avatarkungfupanda007
2/9/2023, 5:24:09 AM

then use genieauthentication as per guidelines on website

Author AvatarJuliane Müller-Sielaff
2/9/2023, 7:59:56 AM

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?

Author AvatarPere
2/13/2023, 2:02:02 PM

@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:

  1. connect to a sqlite db
  2. generate the migration and module files for a new resource
  3. edit the migration file with the table schema for the resource
  4. define in the resource module in app/resources/ the resource struct matching the table schema
  5. execute the migration to create the table
  6. seed the table with some initial data

1https://github.com/GenieFramework/GenieFrameworkDemos_NewAPI/tree/main/Database

Author Avatarabhimanyuaryan
2/13/2023, 2:30:25 PM

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

Author AvatarJuliane Müller-Sielaff
2/14/2023, 7:06:43 AM

Hello, I found a solution by myself 🙂

  1. create the Genie Builder App
  2. Create database similar to: https://docs.juliahub.com/Genie/8eazC/1.3.0/guides/Working_With_Genie_Apps.html#Accessing-databases-with-SearchLight-models
  3. follow the GenieAuthentication instructions: https://github.com/GenieFramework/GenieAuthentication.jl
  4. Remove lines with „output_flash“ from html files in app/resources/authentication/views and AuthenticationController.jl
  5. Add following to app.jl :
    1. @page("/login", "app/resources/authentication/views/login.jl.html")
    2. @page("/register", "app/resources/authentication/views/register.jl.html")
    3. @page("/success", "app/resources/authentication/views/success.jl.html")

Then, it works 🙂

Author Avatarabhimanyuaryan
2/15/2023, 8:20:54 PM

@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