artanis
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Artanis] Beginner: Trouble running artanis without '/etc/artanis/'


From: Nala Ginrut
Subject: Re: [Artanis] Beginner: Trouble running artanis without '/etc/artanis/'
Date: Tue, 03 Jul 2018 17:13:19 +0800
User-agent: mu4e 1.1.0; emacs 25.1.1

Hi Tonton!
First, thanks for join Artanis!
And I'm sorry about lacking of the tutorial, the manual is not so
friendly for beginner folks. I promise that I'll fix it in the future,
maybe a Gitbook for teaching practical usage.

After you did 'art draw contoller index show', there'll be some files
genereated, and you just need to modify these files:
--------------------
app/controller/index.scm
app/views/index/show.html.tpl
--------------------

Modify your app/controller/index.scm, like this:
----------------code---------------------
(index-define show
(lambda (rc)
(let ((me "Tonton"))
(view-render "show" (the-environment)))))
----------------end---------------------

Add this line between the <body> ... </body> of your 
app/view/index/show.html.tpl:
----------------code------------------
<body>

<p> hello <%= me %> </p>

</body>
-----------------end------------------

Then run 'art work' and visit this link in your browser:
http://localhost:3000/index/show

This is called MVC patter, the function in controller will be triggered
when you visit the proper address in your browser, and the view is the
templation of your html page, which will be rendered when certain
controller function is triggered. There's magic that the varialbles
defined in your controller function will be captured and rendered to
your web page by the viewer.

Enjoy!


Tonton writes:

> I found I can start the server with 'art work'.
>
> I still have no clue how I add index.html... Tried 'art draw controller index
> show' and got some files. But the index (localhost:port/) still gives me the
> "can't find index.html". Same happens when I add a index.html file to the
> root of the app directory.
>
> I'm guessing I'm missing some URL routing and more, but I don't understand
> where this should live.
>
>
> For some reason the art command crashes with a backtrace on all incorrect
> invocations and with the --help flag; which is why I didn't try it until now.
> Might be because of some guix specifics. I haven't had the time to look into
> it yet.
>
> On Fri, 29 Jun 2018 01:21:07 +0200
> Tonton <address@hidden> wrote:
>
>> Hey!
>>
>> I've finally gotten around to try out Artanis, but I struggle making it even
>> start.
>>
>> I'm on GuixSD, so I can create files in /etc/ but I prefer not to. I guess
>> that would have made the start a bit simpler. (This is because in GuixSD
>> _everything_ can be/is defined in a configuration file for the OS - And I'd
>> like to add it through the config, which currently is a teenie bit of work
>> on my end, I'd prefer getting Artanis working without this requirement)
>>
>> I packaged artanis 0.2.5 and am using it for my efforts here (will send it
>> to Guix ASAP).
>>
>> I saw in the docs I can use an application folder as an alternative
>> to /etc/artanis/... So I used 'art create PROJECT' to create one. First
>> reaction is "wow, that's a lot of files and folders - I have no idea where
>> to start..."; I couldn't really figure out how to get started from this.
>>
>> I tried evaluating the ENTRY file in geiser, and keep getting:
>>      #<procedure init-config ()> "Fatal error! Do you
>>      have /etc/artanis/artanis.conf?"
>> Not sure how to get around this, without adding files to /etc/ - which I
>> don't want to do.
>>
>> I am also a beginner at Scheme/Lisp, but so far most things make sense. The
>> docs look good as reference, but I am missing a sort of noob guide or
>> similar for this. Love the intro to scheme for X-istas   :-)
>>
>> Look forward to hacking on a webpage and if I'm capable, Artanis.
>>
>> Tonton
>>      :-)


--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]