agentsclimarketplace

Configure clojure ring compojure backend for json api with cors

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8/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.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill configure-clojure-ring-compojure-backend-for-json-api-with-cors

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.0 KB, 327 tokens by cl100k_base, as published. Nobody here has run it

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

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.