arisuchan    [ tech / cult / art ]   [ λ / Δ ]   [ psy ]   [ ru ]   [ random ]   [ meta ]   [ all ]    info / stickers     temporarily disabledtemporarily disabled

/λ/ - programming

structure and interpretation of computer programs.
Name
Email
Subject
Comment

formatting options

File
Password (For file deletion.)

Help me fix this shit. https://legacy.arisuchan.jp/q/res/2703.html#2703

Kalyx ######


File: 1492638627031.png (456.85 KB, 512x512, elixir-on-the-web.png)

 No.21

so have somewhat fallen for the elixir hype. written my way through 50-or-so
problems on exercism, project euler, et al. and think i'm in love.

the problem, though, is somehow moving past that and onto "real-world
applications". i'd really like to swap out the guts of my small personal
website, which currently runs on an awful mess of php generating script-less
html, to use elixir as a backend.

so the requirement, then is "respond to ssl-encrypted http requests by spitting
out generated html", with no worrying about scripts or databases or anything
else. what's the simplest way to go about this? most things seem to point at
Phoenix, but it looks to be some kind of giant stack, and it's introductory
guides all seem geared towards people who've used other "web frameworks"
before, which foreign terminology littered throughout.

 No.39

I have also boarded the Elixir hype train. Unlike you, though, I only got to tinker with it for a weekend.

Starting in June, I'll have more free time, and will definitely pick it back up.

 No.75

The simplest way is to use a micro framework. I don't know Elixir, but try Plug + Trot.

 No.161

I had some fun with the phoenixframework.

 No.162

oh, and #elixir-lang on freenode ist nice, if you got questions.

 No.593

>>21
>most things seem to point at Phoenix, but it looks to be some kind of giant stack, and it's introductory guides all seem geared towards people who've used other "web frameworks" before, which foreign terminology littered throughout.
The guides on the Phoenix site are actually pretty simple and explain the overall concept of Phoenix very well, Im surprised you had trouble with it. If you understand Rails its very easy to transition to Phoenix. If you have questions how Phoenix works, ask me here and I will try to explain.

>so the requirement, then is "respond to ssl-encrypted http requests by spitting out generated html", with no worrying about scripts or databases or anything else. what's the simplest way to go about this?

Im having trouble figuring out what you want to to do here, do you just want to serve static files and render them to templates? Because that is super easy. Just remember that Phoenix reverses the order of views in templates. In rails a template generates the markup that gets rendered to a view. In Phoenix a view organizes the data that gets rendered to templates.

 No.596

File: 1504369752622.jpg (249.84 KB, 600x1350, WHAT A HECK.jpg)

>>593
yes, see, this is what i meant about terminology. i've never used rails or any other web framework thing. i have no idea what a "view" is or what a "template" is in this context. so i look at that site and it gets me nowhere.

all i want to do is, over ssl, send html files and the files they reference, with the contents of the files calculated from the local filesystem and url arguments as the only inputs.

 No.598

>>596
ok, Im actually learning backend web development myself, so I cant say much about ssl. But on the second page of the guide "Adding Pages" it shows how to add a static page, in the middle it shows how to add a /hello static webpage. Sorry, I can only answer general questions about Phoenix, Im not good enough to get into specifics.

 No.601

>>598
well thanks anyways. will take a look again during next school break.

if you've made anything yourself, though, would be interested to see. and maybe that would be enough to get a feel for how things work, just a super simple working example.

 No.602

>>596
> yes, see, this is what i meant about terminology. i've never used rails or any other web framework thing. i have no idea what a "view" is or what a "template" is in this context. so i look at that site and it gets me nowhere.

So this comes from MVC frameworks, Modal, View, Controller.

The Modal is the translation layer to your datastore(like a database), it stores references to any long term stored vars for a controller.

The View is what renders the site the user views through templates.

The Controller ties the View and Modal together, it will normally handle the backend code.

Templates are basic html files that the views pass variables into and get rendered.

So in a simple blog, you would goto the home page, the home page controller would query the modals and get a list of blog entries, the controller would then feed the entries to the view, the view would reference a template and would render for the user.

Inside the template (pesudo code inc) you would do something like this:
{% foreach entry in posts %}
<li>
    <h2>
        <a href="{%- entry.url -%}">{%- entry.title -%}</a>
    </h2>
    <p>{% entry.shortpost %}</p>
</li>
{% end %}

 No.603

File: 1504404217068.jpg (337.13 KB, 635x999, T1r83ei3o1.jpg)

>>602
thank you so much!

don't feel quite so lost now



[Return] [Go to top] [ Catalog ] [Post a Reply]
Delete Post [ ]