by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Adrian Salceanu
@essenciary
meanwhile you can check Matte.jl
which is built on top of genie and does what you want
yet another early project is Dash.jl which builds a Julia backend for Dash
they are all very young I'm afraid but they might work already quite fine for what you need
prathyushnallamothu
@prathyushnallamothu
can anyone help me create a login page by using genie
how to parse a html file using genie
Adrian Salceanu
@essenciary
@prathyushnallamothu you can use the GenieAuthentication plugin
though it might need some small fixes due to recent changes in SearchLight - I'll see if I can push them today
give it a try and lmk if you get stuck
what do you mean parse a html file? from the internet?
Phelipe Wesley
@phelipe
Hi! How can I enable CORS?
Adrian Salceanu
@essenciary
the Settings object exposes various CORS related options. Check Configuration.jl
Phelipe Wesley
@phelipe
thank you
Phelipe Wesley
@phelipe

@essenciary I set

cors_headers  = Dict{String,String}(
              "Access-Control-Allow-Origin"       => "*", # ex: "*" or "http://mozilla.org"
              "Access-Control-Expose-Headers"     => "*", # ex: "X-My-Custom-Header, X-Another-Custom-Header"
              "Access-Control-Max-Age"            => "86400", # 24 hours
              "Access-Control-Allow-Credentials"  => "", # "true" or "false"
              "Access-Control-Allow-Methods"      => "*", # ex: "POST, GET"
              "Access-Control-Allow-Headers"      => "*", # ex: "X-PINGOTHER, Content-Type"
            ),
  cors_allowed_origins = ["*"],

in my dev.jl file but I still getting CORS error

Phelipe Wesley
@phelipe
@essenciary how can I see the header of a response?
Phelipe Wesley
@phelipe
It only works when I set headers inside the route, if I use cors_headers does not works.
route("/data",  method = "POST")  do
    res = getresponse()
    setheaders!(res, Dict("Access-Control-Allow-Origin" => "*"))
    "data" |> json
end
Adrian Salceanu
@essenciary
@phelipe where did you set them? Where is that cors_headers=... in which file?
Phelipe Wesley
@phelipe
config/env/dev.jl
ENV["GENIE_ENV"] = "dev"
Adrian Salceanu
@essenciary
can you show me the whole file?
just copy-paste it here
Phelipe Wesley
@phelipe
using Genie.Configuration, Logging

const config = Settings(
  server_port                     = 8000,
  server_host                     = "127.0.0.1",
  log_level                       = Logging.Debug,
  log_to_file                     = false,
  server_handle_static_files      = true,
  cors_headers  = Dict{String,String}(
              "Access-Control-Allow-Origin"       => "*", # ex: "*" or "http://mozilla.org"
              "Access-Control-Expose-Headers"     => "*", # ex: "X-My-Custom-Header, X-Another-Custom-Header"
              "Access-Control-Max-Age"            => "86400", # 24 hours
              "Access-Control-Allow-Credentials"  => "", # "true" or "false"
              "Access-Control-Allow-Methods"      => "*", # ex: "POST, GET"
              "Access-Control-Allow-Headers"      => "*", # ex: "X-PINGOTHER, Content-Type"
            ),
  cors_allowed_origins = ["*"]
)

ENV["JULIA_REVISE"] = "auto"
Adrian Salceanu
@essenciary
yeah, looks good - and the values are not available in the app?
Phelipe Wesley
@phelipe

I use
res = getresponse()
getheaders(res)

but no CORS enabled.

So I set it with
setheaders!(res, Dict("Access-Control-Allow-Origin" => "*"))
Adrian Salceanu
@essenciary
I think the reason is this
if req.method == Genie.Router.OPTIONS || req.method == Genie.Router.GET
but CORS should also be allowed for POST requests, according to mozilla
let me add POST and tag a release
Phelipe Wesley
@phelipe
Ok
Adrian Salceanu
@essenciary
I've made a registration request for 0.31.1 which should address this once it's merged
Phelipe Wesley
@phelipe
@essenciary I tested master branch and CORS work now :D
Adrian Salceanu
@essenciary
yeee, fantastic! thanks for letting me know!
rkt
@orklann
Does any organization or company sponsor Genie.jl?
Adrian Salceanu
@essenciary
not yet - it would be helpful but there weren't any efforts in this direction yet. Hopefully after juliacon when we release v1 we'll put a few months work into consolidation: branding, marketing, sponsorship, tutorials, blogging
Marwan Rabbâa
@waghanza
@essenciary I think also participating to https://github.com/the-benchmarker/web-frameworks could be :+1: for promotion
I'll soon comunicate on this project
and you are most than welcome :heart:
nickembrey
@nickembrey
A friend and I are working through the tutorials on the website -- really enjoying the framework so far. My friend found what appears to be a typo in the "Working With Genie Apps: Intermediate Topics" tutorial: when showing code for BooksController.jl, Genie.Router is specified as the only dependency but the redirect function is actually in Genie.Renderer. Let me know if there's a better place to flag/fix!
Igor Souza
@IgorSou73182994_twitter
Hello! :) i'm new on Julia... I'm trying to dockerize a WebApp Julia App... but I'm having so many troubles.. What is the quickest way to to it? @essenciary
Adrian Salceanu
@essenciary
@waghanza defo! though probably better if we can use PackageCompile.jl - benchmarking for Julia apps is tricky due to JIT compilation... :-/
5 replies
@nickembrey I think you're right - can you please submit a PR for the docs?
@IgorSou73182994_twitter a Genie app or a Julia app? If a Genie app, there's the Deploy module which should just work
Igor Souza
@IgorSou73182994_twitter
Hey @essenciary !! Thank you so much! I want to build a genie app ... I think that will solve my issue! I'll try it out! Thanks!
Igor Souza
@IgorSou73182994_twitter

Hey @essenciary .... I followed the docs and everything is right now! Thxs!! :) I just have 2 more questions!! How do I put precompilation to work? and One of my routes is using a external .jl file go get an function! When I start the application via docker-compose it didn't recognize this file until I manually rename the folder thereof. follow the code...

include("op/tsp.jl")

route("/opt/tsp", method=POST) do
dados = jsonpayload()
return (:result => cv(parse.(Float64, dados["a"]), parse.(Float64, dados["b"]))) |> json
end

Do you think is a revise issue? Thank you so much so far!!

Adrian Salceanu
@essenciary
@IgorSou73182994_twitter I'm glad it worked! no idea what's causing the problem, sounds weird
Adrian Salceanu
@essenciary
ah fantastic!
I'll take a look!