Deploying multiple Clojure apps on one server using Reagent, Nginx, and Supervisor (Solved)

2016-12-23 Thread Seth Archambault
I'm posting this because right now someone is scrounging the internet for 3 hours to find this simple solution, I hope that they find this post sooner rather than later, and can move on to their next project! *TLDR* Goto /src/clj/myapp/server.clj Edit "3000" to be whatever you want: (defn -m

POST in Ajax - Invalid anti-forgery token

2016-12-23 Thread Seth Archambault
So when I use cljs-ajax to post to my APP I get an Invalid anti-forgery token error. Despite there being dozens of posts about this issue, none of them have a solution that seems to work if you started your project using this: lein new reagent myapp The first post that comes up as a "solution

Re: POST in Ajax - Invalid anti-forgery token

2016-12-23 Thread James Reeves
The "use" function is a deprecated shortcut for "require" and "refer". I can see why it would be confusing, so I'll change the examples on the ring-anti-forgery site. Packages can contain many namespaces, so in general you won't find package names matching up precisely to the namespace or namespac

Re: POST in Ajax - Invalid anti-forgery token

2016-12-23 Thread Seth Archambault
Wow, thank you! This makes a lot of sense, it sounds like I really do not need CSRF protection.. I'm just adding complexity there.. I think my key mess up here was getting my client side / server side code mixed up in my head. I am really enjoying using ClojureScript and Clojure side by side, b

Re: Deploying multiple Clojure apps on one server using Reagent, Nginx, and Supervisor (Solved)

2016-12-23 Thread James Reeves
I think this is something a lot of web developers take for granted, so perhaps it isn't mentioned as much as it could be. The usual convention in Linux environments is to set the port via the PORT environment variable. So on the command line it would be: PORT=3001 java -jar yourapp.jar That's

Re: [ANN] data.xml 0.2.0-alpha1

2016-12-23 Thread Francis Hitchens
Hi Herwig, I got what my problem is. If I use the keyword (zx/tag= ::can/mqMessageHeader) everything works just fine. But my code is using a string representation of the tag and using keyword to convert it to a keyword (zx/tag= (keyword ":can/mqMessageHeader"))) and this for some reaso

Re: POST in Ajax - Invalid anti-forgery token

2016-12-23 Thread Seth Archambault
Okay, armed with the new clarity, I felt embolden to tackle this once more. Here's the next steps for those trying to tack CSRF protection onto a Reagent project created with lein new reagent. In handler.clj - you'll add the ring.middleware.anti-forgery and refer to *anti-forgery-token* (ns m

Re: Deploying multiple Clojure apps on one server using Reagent, Nginx, and Supervisor (Solved)

2016-12-23 Thread Seth Archambault
:-O That just blew my mind - Thanks! :) On Friday, December 23, 2016 at 11:01:28 AM UTC-5, James Reeves wrote: > > I think this is something a lot of web developers take for granted, so > perhaps it isn't mentioned as much as it could be. > > The usual convention in Linux environments is to set

Re: what tutorials exist for working at the Repl in Emacs?

2016-12-23 Thread Travis Daudelin
> > modern setup in Emacs > I generally recommend https://github.com/bbatsov/prelude for newcomers to emacs, especially if you are interested in Clojure development. As for the repl, Prelude comes with CIDER out of the box and the docs for that are quite good: http://cider.readthedocs.io/en/la

Re: POST in Ajax - Invalid anti-forgery token

2016-12-23 Thread James Reeves
Another way of introducing the anti-forgery token is to bind it to a javascript variable. [:script "var antiForgeryToken = " (pr-str *anti-forgery-token*)] In ClojureScript, you can then access the token with js/antiForgeryToken. The Ring-Defaults library exists to provide a way of applying co

[ANN] Instaparse 1.4.4

2016-12-23 Thread Mark Engelberg
Instaparse is a library for generating parsers from context-free grammars. https://github.com/engelberg/instaparse The big news for this release is that Alex Engelberg has combined the Clojure version with the Clojurescript version of instaparse (initiated by Lucas Bradstreet in 2014) so that movi