Arc Forumnew | comments | leaders | submitlogin
WebApp: Only 1st tutorial example works
4 points by globalrev 5845 days ago | 8 comments
after i run the (asv) how do i get back to the Arc-prompt? now i have to press stop(using drscheme) then run to get going again which is very annoying, esp since it eliminates the code written in the interpreter.

i also have a problem with the other tutorial-examples.

  (defop hello2 req
    (w/link (pr "there") 
      (pr "here")))
when running that it compiles ok but when i go to http://localhost:8080/hello

it says unknown operator. the first hello world app works though.

do i ahve to download some additional library or server-utility?



2 points by croach 5845 days ago | link

One way to stop the Arc application server (i.e., app.arc or asv) is to run the server in a separate thread and kill the thread when you want to stop the server, like so:

  (= app (thread (asv)))
and, to stop it:

  (break-thread app)
This will allow you to get back to the Arc prompt without pressing stop in DrScheme.

As for your second problem, the reason you are having trouble is that you are typing in the URL for the hello operation. You need to use http://localhost:8080/hello2 instead where the portion after the / matches the name of your defop.

Hope that helps out.

-----

1 point by globalrev 5845 days ago | link

yes ty very much.

the break though:

arc> (= app (thread (asv))) #<thread> arc> ready to serve port 8080 (break-thread app) . #<void> . ac.scm::34123: user break

-----

2 points by almkglor 5844 days ago | link

A better way is simply this:

  (thread (asv))
    (... work ...)
  (assert quitsrv*)
Then make one last request to the server (it won't terminate until that last one request, because it's stuck listening on the port. yeah, buggy)

For more info on Arc, see kens' excellent guides on http://arcfn.com http://arcfn.com/doc/index.html

-----

1 point by jkwen 5844 days ago | link

I just installed arc2, but I cannot even get localhost to work at all. Whenever I call serve, or asv, I always get the following message: "The syntax of the command is incorrect", newline, "ready to serve port 8080".

Other than that, the interpreter seems to be recognising / running the samples in the tutorial ok. I am running on MSWinXP env.

Thanks for any insight.

-----

1 point by almkglor 5844 days ago | link

It's a bug I've experienced on Windows. Apparently the windows command line thinks that the terminal program is not running, so it tries to act based on the input (hence "the syntax of the command is incorrect") but it's actually still running, so both the windows command line and the Arc command line act on your input.

It's a problem with Windows itself ^^

-----

3 points by eds 5844 days ago | link

Actually, "the syntax of the command is incorrect" is due to Arc not using Windows style pathnames. (Also note that the -p option is not valid on Windows.)

  C:\User\Programming\Arc>mkdir -p arc/logs/
  The syntax of the command is incorrect.
Both of these are fixed on Anarki.

-----

1 point by almkglor 5843 days ago | link

ah, interesting ^^

-----

1 point by jkwen 5844 days ago | link

Sweet. Thanks.

-----