Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Sep 20 08:32
    vladfaust transferred #85
  • Sep 20 08:32
    watzon opened #25
  • Sep 19 23:51
    watzon opened #85
  • Aug 25 17:33
    t-richards opened #84
  • Aug 13 11:21
    vladfaust closed #7
  • Aug 13 11:19
    vladfaust closed #108
  • Aug 13 11:19
    vladfaust closed #109
  • Aug 13 11:17
    vladfaust closed #24
  • Aug 09 08:46
    vladfaust review_requested #109
  • Aug 09 08:46
    vladfaust review_requested #7
  • Aug 08 20:13
    arubinofaux opened #7
  • Aug 08 20:13
    arubinofaux opened #109
  • Aug 02 11:31
    RemiKalbe edited #24
  • Aug 02 11:29
    RemiKalbe opened #24
  • Aug 01 12:52
    RemiKalbe edited #83
  • Aug 01 12:51
    RemiKalbe opened #83
  • Jul 30 18:36
    vladfaust closed #23
  • Jul 30 18:33
    vladfaust transferred #82
  • Jul 30 18:33
    RemiKalbe opened #23
  • Jul 30 15:55
    RemiKalbe opened #82
Ed
@drum445
@vladfaust do you have a sample project of using MySQL without an orm, just the crystal-mysql lib?
Vlad Faust
@vladfaust
No, I don’t use MySQL at all
Adrian Madrid
@aemadrid
@vladfaust what’s up with Onyx?
Vlad Faust
@vladfaust
What’s up with it? It’s still MIT and got updates in its development branches
Vlad Faust
@vladfaust
There is nothing critical to fix or ship, so I’m not in hurry here. If you’re concerned about testing, it will be done soon. It’s still possible to test endpoints without much problem using fibers
Jack
@wontruefree
will there be a paid structure for Onyx like Worcr? And if you are apart of one will if carry over to the other?
Vlad Faust
@vladfaust
I had some ideas of having a commercial functionality for Onyx. Mainly related to authentication
But almost all features will be still MIT. Onyx would act as an advertiser for Worcr, so they'd depend on each other
Jack
@wontruefree
does onxy/sql have transactions?
Vlad Faust
@vladfaust
@wontruefree Onyx::SQL doesn't need transactions on its own, as they're supported by crystal-db. However, there is a proposal for prettier API for Onyx itself -- onyxframework/onyx#14
Vlad Faust
@vladfaust

You can preview the next Onyx::EDA at v0.3.0-rc.1. Its API is updated too -- https://api.onyxframework.org/eda/index.html.

Onyx::SQL got a sweet new 0.7.2 release as well.

Onyx::HTTP is patched too.

I'm looking forward for the next Onyx release (0.4.0), which would include new API, testing helpers and new EDA version support

Vlad Faust
@vladfaust
Gonna update docs and blogposts and then release 0.4.0
Muhammed Yaşar
@yorci
Hi @vladfaust , do you have any nosql odm plan in the future?
Vlad Faust
@vladfaust
@yorci No, I don't think so. NoSQL has no standard and I see no point in supporting certain database drivers
Muhammed Yaşar
@yorci
i see
Lairan
@alex-lairan

NoSQL has no standard, but some subset have standard.

Key Store have (a kind of) standard for example.

Daniel Sokil
@s0kil
Since there are so many of NoSQL DB's, it would be ideal to provide easier integration with the DB of choice.
BlobCodes
@BlobCodes_gitlab
Hello, does anyone know how to use the StaticFileHandler with Onyx ?
Vlad Faust
@vladfaust

Yes, that docs section is still TODO. Onyx::HTTP.listen method has a block to yield (https://github.com/onyxframework/onyx/blob/master/src/onyx/http.cr#L69). You have access to handlers within the block:

Onyx::HTTP.listen do
  pp handlers
end

Handlers is an array, you can modify it as you want, adding or removing custom handlers if needed.

BlobCodes
@BlobCodes_gitlab
Thanks!
Vlad Faust
@vladfaust
My pleasure :)
BlobCodes
@BlobCodes_gitlab

Hmm..
When I try to do this:

spawn do
  Onyx::HTTP.listen do
    handlers.push(HTTP::StaticFileHandler.new("./public",false,false))
  end
end

..the StaticFileHandler makes every page show up as text.
Looks like this:

[some style stuff, etc.]
<body>
<div class="code">404</div>
<h1 class="status-message">Not Found</h1>
  <div class="request-id">Request ID: a53ba92e-3a81-4abf-8252-fb228f560f5e</div>
</body>
</html>
Not Found

(only works in release mode, segfaults in non-release mode)

What can I do so the StaticFileHandler doesn't append that "Not Found" ?

BlobCodes
@BlobCodes_gitlab
I now resolved the segfault issue, but the "Not Found" is still there.. huh..
Vlad Faust
@vladfaust
I guess you have put the handler before router
‘pp handlers’ to see actual handlers and then insert your handler somewhere. Experiment with the best placement for it. You can do ‘handlers.insert(n, your_handler)’ for precision
BlobCodes
@BlobCodes_gitlab
Thanks!
Now everything works like a charm!
Marwan Rabbâa
@waghanza
@vladfaust in https://github.com/onyxframework/http/blob/master/src/onyx-http/middleware/renderer/rest_error.html.ecr we have ::HTTP::Status.new(500)
when trying to compile I have in lib/onyx-http/src/onyx-http/middleware/renderer/rest_error.html.ecr:4: undefined constant ::HTTP::Status
Vlad Faust
@vladfaust
@everyone recent dependency renaming led to colossal failures due to crystal-lang/shards#272. You should avoid using shards install for now.
@waghanza you should use Crystal 0.28.0 for that. Also, don't due to the message above :sweat_smile:
I'l try to fix the error using commits instead of tags later today
Marwan Rabbâa
@waghanza
Crystal 0.28.0 (2019-04-18)

LLVM: 6.0.1
Default target: x86_64-unknown-linux-gnu
Shards 0.9.0.rc1 (2019-02-09)
Vlad Faust
@vladfaust
@waghanza it builds on Travis and on my machine https://travis-ci.org/onyxframework/http
Marwan Rabbâa
@waghanza
@vladfaust :ok: compiling inside a container (docker) ;-), on my workstation I have the shards failure from above
Vlad Faust
@vladfaust
@everyone I've fixed the issue rolling back time_format.cr repository and creating new https://github.com/vladfaust/time-span-humanize. If you encounter any errors regarding to shards from now, you should delete shard.lock and also clean ~/.cache/shards/
Marwan Rabbâa
@waghanza
could someone review this PR => the-benchmarker/web-frameworks#1282, plz ?
Vlad Faust
@vladfaust
Why would you need a review, @waghanza? If it compiles, you did a good job then :)
Marwan Rabbâa
@waghanza
it just because of if there is a cleaner way to code this ;-)
like an advanced feat of onyx not used
Vlad Faust
@vladfaust
If I invent something outstanding, I would never forget to update the code in the bench!
Marwan Rabbâa
@waghanza
:+1:
Qinsi (James) ZHU
@qszhu
Hello, I’m writing an auth module according to this: https://github.com/vladfaust/crystalworld/blob/master/src/endpoints/auth.cr Instead of checking the header, it needs to check the request body. However, in the endpoint that includes this module a json macro is used, and it seems the context.request.body is already consumed by it before the before callback is called. Any ideas?
Vlad Faust
@vladfaust
Hey, @qszhu, thanks for the question! You could try rewinding the request body (context.request.body.rewind), but I'm not sure if it would work 🤔. For some reason in current release there is no way to preserve the body... Another workaround is to copy the body in a handler (i.e. custom middleware)
Qinsi (James) ZHU
@qszhu
rewind is unimplemented since the body I’m getting is a FixedLengthContent < IO::Sized: https://github.com/crystal-lang/crystal/blob/b42631e9b3c62621f42832755427d530c6e452d2/src/http/common.cr#L37 I tried to patch HTTP::Request like this: qszhu/http@d15c225 It works, but it feels awkward (and possibly with additional memory impact?). I’m still new to crystal, so any suggestion is welcome.
Vlad Faust
@vladfaust
@qszhu yes, body is always of fixed length. Copying the body on every request (i.e. monkey-patching the HTTP::Request class) would indeed affect the performance. That's why I've opened onyxframework/http#77. Note that the body is read on json and form params parsing only, and it should stay unread in an endpoint if no such a parsing happened
Qinsi (James) ZHU
@qszhu
Well, if I read it correctly, the body is only parsed if the content length is not zero. Thus, it’s only copied in those POST/PUT requests that you usually need to do json/form params parsing. The only difference is when there is a request body and you chose not to parse params from it. Am I right? Still, copying is not ideal. I used to implement this kind of stuff in a custom middleware plugged into specific routes (in Express.js/Koa.js). It seems there’s no easier way than mangling with the fixed middleware pipeline of onyx right now.
Vlad Faust
@vladfaust
Once the issue is closed, it would be easy
Qinsi (James) ZHU
@qszhu
Great! 👍 Is there anything I can help?
Vlad Faust
@vladfaust
That's quite advanced level, therefore I don't think so. I'll tackle it in days, as you currently have a workaround
Adrian Madrid
@aemadrid
is there a way to list the routes defined?