Skip to content

Instantly share code, notes, and snippets.

@borkdude
Created May 16, 2012 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borkdude/2712544 to your computer and use it in GitHub Desktop.
Save borkdude/2712544 to your computer and use it in GitHub Desktop.
Noir parameters
macbookair-michiel:noir Borkdude$ lein repl
nREPL server started on port 55453
Welcome to REPL-y!
Clojure 1.3.0
Exit: Control+D or (exit) or (quit)
Commands: (user/help)
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
(user/sourcery function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org: [clojuredocs or cdoc]
(user/clojuredocs name-here)
(user/clojuredocs "ns-here" "name-here")
nil
user=> (use 'noir.core)
nil
user=> (use 'noir.util.test)
nil
user=> (require '[noir.server :as server])
nil
user=> (defpage "/" {:as foo} (str "This is foo: " foo))
{:GET-- #<core$if_method$fn__1512 compojure.core$if_method$fn__1512@101575b4>}
user=> (server/start)
ArityException Wrong number of args (0) passed to: server$start clojure.lang.AFn.throwArity (AFn.java:437)
user=> (server/start 8081 {:mode :dev :ns 'user})
Starting server...
2012-05-16 19:54:15.984:INFO:oejs.Server:jetty-7.6.1.v20120215
Server started on port [8081].
#<Server org.eclipse.jetty.server.Server@25e0cbd8>You can view the site at http://localhost:8081
user=> 2012-05-16 19:54:16.029:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8081
(send-
send-off send-request send-request-map
(send-request
send-request send-request-map
(send-request "/")
{:status 200, :headers {"Set-Cookie" ("ring-session=0677cf04-0b50-457e-9f5a-8b61f603d3d3;Path=/"), "Content-Type" "text/html; charset=utf-8"}, :body "This is foo: {}"}
user=> (send-request "/" {"name" "Michiel"})
{:status 200, :headers {"Set-Cookie" ("ring-session=e3b0655d-139c-409b-8ca4-0a628ce0c230;Path=/"), "Content-Type" "text/html; charset=utf-8"}, :body "This is foo: {:name \"Michiel\"}"}
user=> (defpage [:post "/"] {:as foo} (str "This is foo with post: " foo))
{:POST-- #<core$if_method$fn__1512 compojure.core$if_method$fn__1512@5cf6930>, :GET-- #<core$if_method$fn__1512 compojure.core$if_method$fn__1512@101575b4>}
user=> (send-request [:post "/"] {"name" "Michiel"})
{:status 200, :headers {"Set-Cookie" ("ring-session=ec0c84e4-41c0-4a0d-a653-cb5cfffa28e3;Path=/"), "Content-Type" "text/html; charset=utf-8"}, :body "This is foo with post: {:name \"Michiel\"}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment