Questions tagged [compojure]

Compojure is an open source web framework for the Clojure programming language.

Compojure

Author: James Reeves
Categories: web
License: EPL
Source code: https://github.com/weavejester/compojure

Dependencies: clojure.contrib, a Java servlet container (e.g. Jetty)

Compojure is a web framework that emphasizes a thin I/O layer and a functional approach to web development. It includes an integrated Jetty web server, but can be used with any Java servlet container.

FAQ

Useful links

442 questions
10
votes
3 answers

Compojure binds HTTP request params from URL, but not from a POST form

Compojure does not bind the fields in a POST form. This is my route def: (defroutes main-routes (POST "/query" {params :params} (debug (str "|" params "|")) "OK...") ) When I post a form with fields in it, I get |{}|, i.e. there are no…
George
  • 3,433
  • 4
  • 27
  • 25
10
votes
1 answer

Why does ring's resource-response respond with application/octet-stream content type?

I am trying to figure out why Ring's resource-response is choosing to respond with an application/octet-stream content type. I recently updated some sample code, that I've been learning from, so that it uses the newer ring-defaults. Prior to using…
Ryan
  • 7,733
  • 10
  • 61
  • 106
10
votes
2 answers

Could not locate compojure in classpath

I am trying the various Getting started examples and I can get a basic hello world example working with basic HTML in the route as such (ns hello-world (:use compojure.core ring.adapter.jetty) (:require [compojure.route :as route])) (defroutes…
Xian
  • 76,121
  • 12
  • 43
  • 49
10
votes
1 answer

Compojure/Ring: Why doesn't a session with cookie-store survive a server restart?

I have a compojure app that uses the ring session wrapper to store the OAuth token associated with the current user. I would like for this token to remain available when the server restarts, so that I don't have to go through the auth process each…
jgre
  • 787
  • 5
  • 11
9
votes
1 answer

how to return a clojure function as a string

is there any way to return a clojure function as a string? I am making some online documentation and I would really like to be able to add code into the html by somehow evaluating a function into text. thanks
Jon Rose
  • 1,457
  • 1
  • 15
  • 25
9
votes
1 answer

hiccup 1.0.0-beta1 error

I'm creating a compojure project using hiccup-1.0.0-beta1. I get the following stack trace when I run lein ring server-headless: Caused by: java.lang.IllegalAccessError: defelem does not exist at clojure.core$refer.doInvoke(core.clj:3287) at…
Kevin
  • 24,871
  • 19
  • 102
  • 158
9
votes
2 answers

Is there a way to do a hot reload in compojure?

I'm new to clojure and compojure and I was wondering if there's a way to do a hot reload of code changes as you can with Ruby's Sinatra (with the shotgun gem) or Java's Play! I'm following along with this Heroku tutorial so if there's a way to do it…
kreek
  • 8,774
  • 8
  • 44
  • 69
9
votes
5 answers

Clojure web framework for designers/ front end devs

All of the popular Clojure web frameworks I am seeing use hiccup to generate HTML. I find hiccup is hard to have a front end design person adjust to, compared to other frameworks that parse the syntax out of templates. Is there a clojure web…
Mantas Vidutis
  • 16,376
  • 20
  • 76
  • 92
9
votes
2 answers

Local dependencies in Leiningen without creating a Maven repo?

I'm building a Compojure web application, and I'd like it to use functions from another Clojure project I wrote. I'm not at all familiar with Maven, and from what I've heard, it has a very steep learning curve. Unfortunately, everything I've seen…
Adam Incera
  • 117
  • 1
  • 5
9
votes
1 answer

Getting started with CSS in Compojure?

I found a very basic web page on the Internet and now I would like to do the obvious thing and add some CSS so I can build nicer pages. How can I include jQuery, as well as other style sheets? How can I include inline CSS so I can throw in a…
anon
9
votes
2 answers

Use Friend for authentication and authorisation in a single page Clojure web application

I am trying to integrate Friend authentication and authorisation into a Clojure/Compojure single-page web application. I have a login form backed by an Angular controller, and this controller uses AJAX to authenticate username and password against…
caprica
  • 3,902
  • 4
  • 19
  • 39
9
votes
2 answers

How do I use snippets in enlive?

I'm a Rails dev getting my feet wet in Clojure. I'm trying to do something which was very simple with ERB but I can't for the life of me figure it out in enlive. Say I have a simple layout file for a website in layout.html:
Chris Bui
  • 1,055
  • 1
  • 13
  • 24
8
votes
1 answer

ring/compojure without jetty

I know it's possible to create a war file using lein ring war, but it seems to still include jetty dependencies. Is there a way to exclude the jetty dependencies when I'm building the war (and deploying on tomcat)? If I can't does this matter at…
Kevin
  • 24,871
  • 19
  • 102
  • 158
8
votes
1 answer

Invalid anti-forgery token

I'm getting an "Invalid anti-forgery token" when I try using POST method in a Clojure Webapp project I created using Compojure template. I researched, and Ring middle ware creates CSRF (cross site request forms) tokens to authenticated requests…
8
votes
2 answers

What is your way to do GAE Apps using Clojure?

I want to develop apps on GAE using Clojure with Compojure, using either Eclipse or Idea, emacs is not a bad idea :P So which are the best ways to do this? I don't think that I want to use leiningen because I believe that maven can be very strong if…
user171910
1 2
3
29 30