I've also been using elm on the server side, and have some thoughts:

In elm-0.18 you'll use a Platform.program or Platform.programWithFlags and 
pass command line arguments via the flags from a small javascript runner. 
 Unlike Sonny Michaud's approach, I've used the normal 
init/update/subscriptions approach and it can also work well.

The skeleton I made for elm on node is here:
https://github.com/prozacchiwawa/elm-worker-runner-example

You can use web side elm packages like Html (alongside 
elm-server-side-renderer) and elm-lang/http as well if you're willing to 
postprocess the elm output a small amount.

On Friday, February 24, 2017 at 7:56:11 AM UTC-8, Tom F wrote:
>
> Hey guys,
>
> I'm also very interested in running elm server side (especially node.js), 
> and would appreciate to hear about your experiences & tips.
>
> Thx !
>
> On Friday, January 9, 2015 at 6:09:11 PM UTC+1, Sonny Michaud wrote:
>>
>> Everything Joey said is spot on.  I should have pointed out that my 
>> library simply takes care of running elm-compile for you and giving you 
>> access to the ports from your Elm code.  Basically, the point is to reduce 
>> the friction of those additional build steps for you.  There is also an 
>> interoperability layer between the ports from Elm and Node EventEmitter 
>> objects, so people familiar with the latter can concern themselves with the 
>> details less.
>>
>> - Sonny
>>
>> On 01/09/2015 11:59 AM, Joey Eremondi wrote:
>>
>> @robcuz the important thing to remember is that Elm is just a way to 
>> translate elm code into JavaScript.
>>
>> So really, you can run Elm with any platform that interacts with JS, 
>> because the result of elm-make is JavaScript. So you use the code Elm 
>> generates as part of a JS project. Ports makes this particularly elegant.
>>
>> Here's the tutorial on Ports:
>> http://elm-lang.org/learn/Ports.elm
>>
>> As for importing libs into elm-repl, that's not possible because it would 
>> violate purity. It's easy to call Elm from JavaScript, but calling 
>> JavaScript from Elm is tough, because there's no guarantee that JS code is 
>> pure (performs no side-effects) or typesafe. So your best bet is to choose 
>> the functionality you want to import and set up ports for them.
>>
>> On Friday, January 9, 2015 at 5:24:53 PM UTC+1, Sonny Michaud wrote: 
>>>
>>> I wrote a NPM module that goes in the opposite direction - allowing you 
>>> to import Elm code into your JS: 
>>> https://www.npmjs.com/package/elm-loader
>>>
>>> - Sonny
>>>
>>> On 01/09/2015 08:45 AM, robkuz wrote:
>>>
>>> I havent found anything to declare the contrary but also nothing that 
>>> says its possible. 
>>> And if it is possible can I import JS libs into the ELM Repl? or how is 
>>> that done?
>>>
>>> Thanks for clarification
>>>
>>> Rob
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Elm Discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to elm-discuss...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Elm Discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to elm-discuss...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to