Arc Forumnew | comments | leaders | submitlogin
1 point by jsgrahamus 5020 days ago | link | parent

The first 3 examples of hello all functioned as I thought they should. But when I got to the fourth one, I expected a form with some prompts and a link. Rather, all I got was a web page saying It's alive. Where did that come from?

The code follows:

  arc> (defop hello req (aform [w/link (pr "you said: " 
  (arg _ "foo"))
                               (pr "click here")]
                               (input "foo")
                               (submit)))
  #<procedure: gs1709>
  arc> (asv)
  ready to serve port 8080


1 point by evanrmurphy 5019 days ago | link

"It's alive." is just a tongue-in-cheek message printed by default to the root page (probably http://localhost:8080/) of a running instance of the Arc server. You can see where it comes from if you open the file srv.arc in your arc directory and look for the line:

  (defop || req (pr "It's alive."))
The || from that is a symbol for empty, so just as your (defop hello ...) command puts a page at http://localhost:8080/hello, (defop || ...) puts a page at http://localhost:8080/. (Nothing comes after that final slash since we used the empty symbol instead of "hello".) You could replace the default "It's alive." message by running a command like

  (defop || req (pr "jsgrahamus rox!"))
at the REPL.

Were you able to get this stuff working, by the way, or are you still stuck??

-----

1 point by akkartik 5020 days ago | link

Go to http://localhost:8080/hello

-----