Skip to content

Commit

Permalink
chore: useful commands for mock-server
Browse files Browse the repository at this point in the history
  • Loading branch information
krvital committed Sep 24, 2024
1 parent 7b93399 commit 8f4bddb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ test: ## Run tests
test-snapshots: ## Run snapshot tests
clj -M:test -m kaocha.runner --focus-meta :snapshot

serve-mocks: ## Run mock server
clj -M -m mock-server.main
run-mock-server: ## Run mock server
clj -M -m mock-server.main &

stop-mock-server: ## Stop mock server
kill -9 `pgrep -f "clojure.main -m mock-server.main"`

PATH_TO_JAR := $(project_dir)/$(jar_path)

Expand Down
8 changes: 4 additions & 4 deletions src/mock_server/main.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(ns mock-server.main
(:require [org.httpkit.server :as server]
[clojure.java.io :as io]
[clojure.data.json :as json]))
(:require
[org.httpkit.server :as server]
[clojure.java.io :as io]))

(defn not-found []
{:status 404
:headers {"Content-Type" "application/json"}
:body (json/write-str {:status 404})})
:body "{\"status\":404}"})

(defn app [req]
(case (:uri req)
Expand Down

0 comments on commit 8f4bddb

Please sign in to comment.