Web Development with Clojure, Third Edition - reitit error in chapter 2 (page 43)

Hello,

I’ve been following along with the book and I am having an issue with “reitit” in Chapter 2. I downloaded the source code included with the book and diffed it to what I had typed. I can’t figure out what I am doing wrong.

As far as I can tell my project.clj and core.clj are the same as the book’s.

The error message is

Syntax error (FileNotFoundException) compiling at (ring_app/core.clj:1:1).
Could not locate reitit/ring/as__init.class, reitit/ring/as.clj or reitit/ring/as.cljc on classpath.

my code is here GitHub - jlangson/ring-app-demo

I am currently at commit 820154c337e2fbc988840bc895353c92f0a3636b

My suggestion is to add clarification to help avoid whatever is causing my error.

@Dmitri and @svmbrown (author tags added by @Margaret)

Hi, it looks like that might be an artifact of how you’re starting the app. It might be that the project wasn’t imported into intellij as a Leiningen project. Try reimporting it using File->New->From Existing Sources and make sure you select Leiningen in the menu.

If you start the app in the github repo using lein run from the terminal, you should see something like the following:

2021-04-15 12:29:30.111:INFO::main: Logging initialized @2866ms to org.eclipse.jetty.util.log.StdErrLog
2021-04-15 12:29:30.583:INFO:oejs.Server:main: jetty-9.4.31.v20200723; built: 2020-07-23T17:57:36.812Z; git: 450ba27947e13e66baa8cd1ce7e85a4461cacc1d; jvm 12.0.1+12
2021-04-15 12:29:30.638:INFO:oejs.AbstractConnector:main: Started ServerConnector@2ca132ad{HTTP/1.1, (http/1.1)}{0.0.0.0:3000}
2021-04-15 12:29:30.638:INFO:oejs.Server:main: Started @3393ms

and you’ll be able to navigate to localhost:3000 in the browser. So, the project itself looks like it’s working.

It turned out to be a simple mistake on my end. I was missing a :

I had
[reitit.ring as reitit]

when I needed

[reitit.ring :as reitit]