Code Monkey home page Code Monkey logo

compojure-api-examples's Introduction

Compojure-api-examples

Example project for using Compojure-api.

Usage

Running

lein ring server

Packaging and running as standalone jar

lein do clean, ring uberjar
java -jar target/examples.jar

Packaging as war

lein ring uberwar

License

Copyright © 2014-2015 Metosin Oy

Distributed under the Eclipse Public License, the same as Clojure.

compojure-api-examples's People

Contributors

allentiak avatar deraen avatar ikitommi avatar mveytsman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

compojure-api-examples's Issues

Example running on GAE

Hi folks,

Just getting started with compojure-api; looks very good. I managed to get your example running on Google App Engine - well, at least on the dev server. It's surprisingly simple, and with a minor (but nasty) hack you get something like a REPL. If you want to add a GAE sample here let me know.

-Gregg

lein ring uberwar => No such var: tf/parse-local-date

Somehow lein ring uberwar tries to use old version of clj-time (pre 0.6.0). Adding [clj-time "0.6.0"] to dependencies fixes this.

% lein ring uberwar
Exception in thread "main" java.lang.RuntimeException: No such var: tf/parse-local-date, compiling:(ring/swagger/coerce.clj:14:25)
    at clojure.lang.Compiler.analyze(Compiler.java:6380)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)

Error while running basic compojure-api

I have created one project lein new compojure-api my-app command and ran the project with lein run command
I am getting this error.
Exception in thread "main" java.lang.AbstractMethodError: Method compojure/api/routes/Route.invoke()Ljava/lang/Object; is abstract, compiling:(/private/var/folders/sc/_5vqrzqd6957db1699lb0lm00000gq/T/form-init5955368636245682796.clj:1:125)

lein ring uberwar fails, No matching clause: class compojure.api.swagger.CompojureRoutes

After #1 is fixed (by adding clj-time 0.6.0 to deps), lein ring uberwar still fails. Due to some macro expansion problems?

$ lein clean ; lein ring uberwar 
Exception in thread "main" java.lang.IllegalArgumentException: No matching clause: class compojure.api.swagger.CompojureRoutes, compiling:(samlink_jboss_monitor/handler.clj:15:3)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6567)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3624)
...
Caused by: java.lang.IllegalArgumentException: No matching clause: class compojure.api.swagger.CompojureRoutes
    at compojure.api.swagger$create_paths.invoke(swagger.clj:81)
    at compojure.api.swagger$extract_routes.invoke(swagger.clj:120)
    at compojure.api.swagger$swagger_info.invoke(swagger.clj:128)
    at compojure.api.swagger$swaggered.doInvoke(swagger.clj:169)

contextPath is missing from generated paths

  1. Generate war
    lein ring uberwar
  2. Deploy war to tomcat or some other server
    sudo cp target/examples.jar /var/lib/tomcat/webapps/examples.war
  3. Access pizza api http://localhost:18080/examples/api/pizzas=> works as expected
  4. Access ui http://localhost:18080/examples/ => redirects to http://localhost:18080/index.html. Should redirect to http://localhost:18080/examples/index.html
  5. Access http://localhost:18080/examples/index.html (this is the correct URL), there is error Can't read swagger JSON from http://localhost:18080/api/api-docs

When war is deployed as a root war (that is, contextPath is '/') everything works.

Some component (swagger-ui?) should include contextPath to generated URLs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.