Questions tagged [luminus]

Luminus is a Clojure Web Micro-framework which uses Compojure, Ring and some popular middlewares

102 questions
1
vote
5 answers

Hugsql can not read my sql file

I am truely lost here. I have a very simple application. All it does is to insert a user into the user table in my Database. I using Postgres. The code is (ns signupper.db (:require [hugsql.core :as hugsql])) (hugsql/def-db-fns "sql/q.sql") Inside…
eitan
  • 59
  • 8
1
vote
1 answer

Cider version does not match cider-nrepl version in new luminus project

I'm experimenting with luminus, and all new luminus projects are giving me the cider version/ cider-nrepl version mismatch error when I connect to the repl started by lein run using emacs M-x cider-connect: WARNING: CIDER's version (0.14.0) does not…
Iain
  • 300
  • 2
  • 13
1
vote
1 answer

Can't get keys from a hashmap in guestbook app

I'm playing with the luminus guestbook app. I added some logging statements in g.test.db.core.clj to look at the keys of the data structures. Look at "Expected Keys" and "Actual Keys" below. (deftest test-messages (jdbc/with-db-transaction…
ahoffer
  • 6,347
  • 4
  • 39
  • 68
1
vote
0 answers

Redirect to /login for unauthenticated users

I'm trying to get a good handle on auth for compojure, ring apps. What I want to do is redirect to /login if the user is not authenticated. The below approach seems to be doing what I want. I added the wrap-restricted handler to my #'home-routes…
Frank Henard
  • 3,638
  • 3
  • 28
  • 41
1
vote
1 answer

How to get logged in user's id from session in LuminusWeb

I've just saved the current logged-in user in session. Now how do I get user's id from session in Selmer templates?. Thanks (defn login-form [{:keys [flash]}] (layout/render "login_form.html" (merge (select-keys flash [:id :pass…
no_freedom
  • 1,963
  • 10
  • 30
  • 48
1
vote
1 answer

Compojure-api removes body-param after the first group of API routes

I am currently using the Luminus template with the +swagger option, which adds compojure-api support. My current setup is like so (only relevant bits): (ns my-project.routes.services (:require [compojure.api.sweet :refer :all] …
Alan Tran
  • 58
  • 6
1
vote
1 answer

why is this lein new template is failing

I just started with clojure web development, but, got stuck on step 1. D:\cloj\work>lein new luminus guestbook +h2 Could not find artifact luminus:lein-template:jar:? in central (https://repo1.maven.org/maven2/) Could not find artifact…
user19937
  • 587
  • 1
  • 7
  • 25
1
vote
1 answer

Could not locate clojure/data/xml__init.class in a luminus project

In my luminus project I've added this: [org.clojure/data.zip "0.1.2"] to the list of dependencies but this throws an exception still: (ns myapp.rss (:use [clojure.data.xml :as xml :only [emit]])) which is: Could not locate…
user6574649
1
vote
2 answers

Processing multiple fields with map in Luminus/Compojure

I have this: (defn my-page [] (layout/render "page1.html" ({:articles (map #(update % :field1 (fn [d] (something.... ))) (db/get-all-articles))}))) ; how can…
user6324692
1
vote
3 answers

How to replace substrings?

I have this: (defn page1 [] (layout/render "index.html" ({:articles (db/get-articles)}))) The function db/get-articles returns a list of objects which have the key body. I need to parse the body of the articles and replace, if exists, a…
user6324692
1
vote
1 answer

How can I do redirect 301 http in a Compojure/Luminus app?

I have an action in an Compojure/Luminus app: (defn my-page1 [id] (layout/render "my_page.html" (let [item (db/get-single-item {:id id})] ; this throws an exception ; if ..... ; redirect "fdsfdsfd" :status 301 …
user6324692
1
vote
1 answer

Working with SQL in Clojure/Luminus/Composure

1) I have a luminus app. I want to execute multiple db requests within a single db connection, meaning, without having to open a connection a second time. Now I have this: (defn page1 [id] (layout/render "page1.html" (my-var1…
user6324692
1
vote
1 answer

How can I handle html files in Luminus which aren't in "resources"?

I have this: (defn about-page [] (layout/render "about.html" {:title "About"})) But since I have moved the directory "templates" from "resources" to the root directory and on a server I might put it yet in another place, it doesn't work. I did…
user6324692
1
vote
0 answers

How to show data from a db on a page in a web app?

I've setup a database, populated it with data manually for the sake of simplicity, created and set up a jinja template, so my Clojure in Lumminus is working. But how can I actually select data from my db and pass into the template? I have no idea…
user6324692
1
vote
1 answer

Execute function once element is shown

In a reagent app created using luminus via lein new luminus asdf +cljs How can I execute a function once an element, say :div.container in the snippet below, has been shown? (defn about-page [] [:div.container [:div.row [:div.col-md-12 …
Evgeniy Berezovsky
  • 18,571
  • 13
  • 82
  • 156