6 Jan 2021 |
vishal.gautam | Hello | 16:35:40 |
vishal.gautam | I am try to implement automatic code reloading in my macchiato app. I am following the guestbook tutorial | 16:36:57 |
12 Jan 2021 |
| @donald:hope.net left the room. | 18:03:16 |
16 Feb 2021 |
| @tamara:nltrix.net | 08:12:35 |
| @tamara:nltrix.net removed their display name tamara. | 08:13:45 |
| @tamara:nltrix.net left the room. | 10:59:32 |
19 Aug 2021 |
| @andreas:server.matrix4ulm.de | 19:10:28 |
| @andreas:server.matrix4ulm.de removed their display name andreas. | 19:11:25 |
| @andreas:server.matrix4ulm.de left the room. | 19:22:16 |
25 Sep 2021 |
| doglooksgood joined the room. | 07:46:33 |
doglooksgood | Hi, is there a stop server function in macchiato? | 07:46:33 |
nenadalm | hi. start fn returns server: https://github.com/macchiato-framework/macchiato-core/blob/master/src/macchiato/server.cljs#L35 that you can close using close method: https://nodejs.org/dist/latest-v14.x/docs/api/http.html#http_server_close_callback | 12:38:14 |
doglooksgood | I see, the server is the server start with http module. Thank you! | 13:18:05 |
6 Oct 2021 |
| Slack Integration | 08:32:59 |
27 Jan 2022 |
| drewverlee joined the room. | 03:41:53 |
drewverlee | GMEQUCTV if you found a way to implement automic code reloading in the macchiato app i would love to hear it. My theory is that ill be stopping the server then loading the changes, then starting the server. I'm actually not sure i need this to bad sense i don't think my routes will change very often, but it would be nice to have. | 03:41:53 |
nenadalm | I didn't touch my demo app for a while but I believe that reloading routing worked for me.
The way I did it is that on each request I just recreated the router though if debug was on: https://github.com/nenadalm/spa-demo/blob/master/server/src/app/routes.cljs#L138 | 17:23:56 |
nenadalm | maybe it could be also done via mount: https://github.com/tolitius/mount#recompiling-namespaces-with-running-states if the server was it's component. | 17:25:12 |
28 Jan 2022 |
drewverlee | thanks for the follow up. How could you re-create the router if the server was running? wouldn't it complain about the port already being taken? | 01:31:03 |
drewverlee | Or are you just referring to the router, and not the running server process? | 01:31:22 |
nenadalm | > Or are you just referring to the router, and not the running server process?
exactly. by router I meant reitit router. Here it gets created on each request: Or are you just referring to the router, and not the running server process? | 16:27:16 |
29 Jan 2022 |
drewverlee | I guess maybe you don't need to restart the server if you can update the program it's um calling out to? | 04:16:12 |
doglooksgood | How can I extend transit writer for wrap-restful-format, the document is not clear to me.
It asked for {:type .. :opts ...} , where can I find their definitions? | 09:40:26 |
doglooksgood | I finally got something like this
(def transit-opts
{:writer
{:opts
{:handlers
{js/BigInt (transit/write-handler (constantly "N") str)}}}})
But it does not work. | 09:54:28 |
31 Jan 2022 |
drewverlee | Why would a macchiato server handler that consumes a promise inside a go block like this
(fn [request respond] (go (respond (
result in an error about the stream write happening after end? I'm unsure what respond is doing, noly that it should be passed a hashmap with the response schema (body, status, etc...). I assume Error [ERR_STREAM_WRITE_AFTER_END] [ERR_STREAM_WRITE_AFTER_END]: write after end
at new NodeError (node:internal/errors:329:5)
at write_ (node:_http_outgoing:751:11)
at ServerResponse.write (node:_http_outgoing:710:15)
at /home/drewverlee/archmedx/kyber/server/dev/out/cljs-runtime/macchiato/http.cljs:110:5
at /home/drewverlee/archmedx/kyber/server/dev/out/cljs-runtime/macchiato/http.cljs:106:10
at respond_SINGLEQUOTE_ (/home/drewverlee/archmedx/kyber/server/dev/out/cljs-runtime/reitit/ring.cljc:119:43)
at respond__$1 (/home/drewverlee/archmedx/kyber/server/dev/out/cljs-runtime/macchiato/middleware/restful_format.cljs:110:24)
at switch__45133__auto__ ( eval :75:27)
at eval :212:29
at Function.server$core$state_machine__45134__auto____1 [as cljs$core$IFn$_invoke$arity$1] ( eval :234:4) | 17:23:15 |
drewverlee | In the example here https://macchiato-framework.github.io/docs/getting-started the handler calls the function which would block (db call) and passes it a function which function which would then get the results and pass it to the handler.
I'll have to think about that.. | 19:59:59 |
drewverlee | This disucssion on proposal to add async handlers seems educational in this direction https://www.booleanknot.com/blog/2016/07/15/asynchronous-ring.html
it allows the channel to be used as responce body... lets try that lol | 20:23:54 |
drewverlee | likely i'm going to have more luck using reitit-siparri then middlware, thats also what the rest of my application uses... | 21:59:42 |
27 Feb 2022 |
| Евгений Соловьев joined the room. | 16:07:43 |
18 Apr 2022 |
| @wybpip:matrix.org joined the room. | 08:57:59 |