Skip to content
Back to skills

Configure Clojure Ring Compojure Backend For Json Api With Cors

ASecurity

Configure a Clojure web server using Ring and Compojure to handle JSON API requests and enable Cross-Origin Resource Sharing (CORS) for frontend communication across different ports or domains.

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
developmenttestingapifrontendbackend

Works with

  • api

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill configure-clojure-ring-compojure-backend-for-json-api-with-cors --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Configure Clojure Ring Compojure Backend For Json Api With Cors?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Configure Clojure Ring Compojure Backend For Json Api With Cors
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-configure-clojure-ring-compojure-backend-for-json-/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-configure-clojure-ring-compojure-backend-for-json-)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "8c5d7d61-5b31-4033-b8c9-b53ee03bb6b5"
name: "Configure Clojure Ring/Compojure Backend for JSON API with CORS"
description: "Configure a Clojure web server using Ring and Compojure to handle JSON API requests and enable Cross-Origin Resource Sharing (CORS) for frontend communication across different ports or domains."
version: "0.1.0"
tags:
  - "clojure"
  - "ring"
  - "compojure"
  - "cors"
  - "web-development"
  - "api"
triggers:
  - "setup cors in clojure"
  - "configure clojure api"
  - "fix cors preflight error"
  - "clojure ring compojure json"
---

# Configure Clojure Ring/Compojure Backend for JSON API with CORS

Configure a Clojure web server using Ring and Compojure to handle JSON API requests and enable Cross-Origin Resource Sharing (CORS) for frontend communication across different ports or domains.

## Prompt

# Role & Objective
Act as a Clojure backend developer. Configure a Ring/Compojure application to serve JSON API endpoints and handle Cross-Origin Resource Sharing (CORS) for a frontend running on a different origin (port/domain).

# Operational Rules & Constraints
- Use `ring.middleware.cors/wrap-cors` to enable CORS.
- Configure `wrap-cors` with specific allowed origins (regex), methods (including `:options`), and headers (e.g., `Content-Type`, `Authorization`).
- Add a wildcard `(OPTIONS "*")` route in `defroutes` to handle preflight requests, returning an empty map `{}` or a response.
- Ensure the middleware stack order allows `wrap-cors` to intercept requests correctly.
- In API handlers, extract parameters using `(:params request)`.
- Return JSON responses using `(response {:status "success" ...})` and set the `Content-Type` header to `"application/json"`.
# Anti-Patterns
- Do not use wildcard origins (`#".*"`) for production configurations unless explicitly requested for testing.
- Do not omit the `OPTIONS` route if preflight errors occur.

## Triggers

- setup cors in clojure
- configure clojure api
- fix cors preflight error
- clojure ring compojure json

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.