Reputation: 41
I'm trying to learn clojure, and I'm setting up Hello World app. Whe I try to run the app with lein server command, I get the following command:
2022-03-28 20:15:50.629:WARN:oejuc.AbstractLifeCycle:main: FAILED org.eclipse.jetty.server.Server@12d1b1b: java.net.BindException: Address already in use: bind java.net.BindException: Address already in use: bind
My question is, how can I change the default app that app is running in? I tried with killing specific process on that port, but for some reason that does not work. This is my handler.clj file:
(ns todoapp.handler
(:require [compojure.core :refer :all]
[compojure.route :as route]
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]))
(defroutes app-routes
(GET "/" [] "Hello World")
(route/not-found "Not Found"))
(def app
(wrap-defaults app-routes site-defaults))
This is mine project.clj file:
(defproject todoapp "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:min-lein-version "2.0.0"
:dependencies [[org.clojure/clojure "1.10.0"]
[compojure "1.6.1"]
[ring/ring-defaults "0.3.2"]]
:plugins [[lein-ring "0.12.5"]]
:ring {:handler todoapp.handler/app}
:profiles
{:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
[ring/ring-mock "0.3.2"]]}})
Thanks!
Upvotes: 2
Views: 462
Reputation: 1052
You can change the port by:
lein ring server port-number
PORT
or SSLPORT
environment var:port
key to project.clj: {... :ring {:port 1234 ...}}
Upvotes: 2