<commit_before>Compojure is an open source web framework for the Clojure programming language,
designed to be a fast, concise and functional way of developing applications.
It's only requirement is a woring Java VM, as it comes bundled with jar files
for Clojure and the Java HTTP server, Jetty.

Compojure is still in active development, but a lot of the API is now
relatively stable.

Quickstart
==========

1. Grab Compojure from github:

        $ git clone git://github.com/weavejester/compojure.git

2. Run Compojure:

        $ script/run

3. An example "Hello World" application should be up and running at:
http://localhost:8080/


File Structure
==============

By default, Compojure is organised with the file structure listed below. But
there's nothing stopping you taking the Compojure libraries and using them in
any fashion you want.

    +- app             - Your main application code
    |
    +- boot
    |  +- boot.clj     - The script that initializes your application
    |
    +- jars            - The jar files used by the application
    |
    +- lib
    |  +- compojure    - The Compojure libraries
    |
    +- public          - Static files that are served if no route is found
    |
    +- script
       +- repl         - Starts an interactive REPL
       +- run          - Runs non-interactively


Core Libraries
==============

Compojure provides several core libraries that provide the bulk of its
functionality.

HTTP
----

The HTTP module provides Compojure with a RESTful and functional way to define
Java servlets. It's syntax was heavily inspired by the Ruby web framework,
Sinatra.





There are four macros for generating resources:

    GET  POST  PUT  DELETE

These correspond to the HTTP methods of the same name. They take the form:

    (method route & body)

    e.g. (GET "/greet" "Hello visitor!")

The route can be fixed, or embedded with parameters. These parameters can be
accessed via the 'route' map:

    (GET "/greet/:name"
      (str "Hello " (route :name)))

Along with 'route', there are several other bindings available by default in
all resource declarations:

  * method          - the HTTP method
  * full-path       - the full path of the request 
  * param [name]    - a HTTP parameter
  * header [name]   - a HTTP header
  * route [name]    - a named part of the request path
  * session         - a ref to a session-specific map
  * mime [filename] - guesses the mimetype of a filename<commit_msg>Updated README for new servlet syntax<commit_after>Compojure is an open source web framework for the Clojure programming language,
designed to produce concise and functional code without any messing around with
mammoth configuration files and byzantine libraries of interdependent classes.
It's only requirement is a working Java VM, as it comes bundled with jar files
for Clojure and the Java HTTP server, Jetty.

Compojure is still in active development, but a lot of the API is now
relatively stable.

Quickstart
==========

1. Grab Compojure from github:

        $ git clone git://github.com/weavejester/compojure.git

2. Run Compojure:

        $ script/run

3. An example "Hello World" application should be up and running at:
http://localhost:8080/


File Structure
==============

By default, Compojure is organised with the file structure listed below. But
there's nothing stopping you taking the Compojure libraries and using them in
any fashion you want.

    +- app             - Your main application code
    |
    +- boot
    |  +- boot.clj     - The script that initializes your application
    |
    +- jars            - The jar files used by the application
    |
    +- lib
    |  +- compojure    - The Compojure libraries
    |
    +- public          - Static files that are served if no route is found
    |
    +- script
       +- repl         - Starts an interactive REPL
       +- run          - Runs non-interactively


Core Libraries
==============

Compojure provides several core libraries that provide the bulk of its
functionality.

HTTP
----

The HTTP module provides Compojure with a RESTful and functional way to define
Java servlets. It's syntax was heavily inspired by the Ruby web framework,
Sinatra.

To create a servlet, you pass a series of HTTP resource definitions to the
`servlet` function:

    (def #^{:doc "A simple greeter"} greet
      (servlet
        (GET "/greet" "Hello visitor!")
        (ANY "/*"     (page-not-found))))

Compojure also provides a `defservlet` macro, that works as you might expect:

    (defservlet greet
      "A simple greeter"
      (GET "/greet" "Hello visitor!")
      (ANY "/*"     (page-not-found)))

The resource definitions passed to `defservlet` are Compojure's way of
associating a URL route with code that produces a useful HTTP response, such as
a web page or image.

Resource definitions take the form:

    (method route & body)

The method can be any one of the standard HTTP methods:

    GET  POST  PUT  DELETE  HEAD

Or, if you wish to match any HTTP method, you can use

    ANY

The route can be a fixed string, like "/greet", but often you're going to want
to assign certain parts of the route to parameters that affect the output:

    (GET "/greet/:name"
      (str "Hello " (route :name)))

Here, the resource definition assigns the path after "/greet" to the parameter
`:name`. Parameters from routes can be accessed via the `route` function.

Along with `route`, there are several other bindings available by default in
all resource declarations:

  * method          - the HTTP method
  * full-path       - the full path of the request 
  * (param name)    - a HTTP parameter
  * (header name)   - a HTTP header
  * (route name)    - a named part of the request path
  * session         - a ref to a session-specific map
  * (mime filename) - guesses the mimetype of a filename
{'fraction_non_alphanumeric': 0.07482876712328768, 'fraction_numerical': 0.002397260273972603, 'mean_word_length': 2.7953216374269005, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6150591', 'n_tokens_mistral': 1657, 'n_tokens_neox': 1521, 'n_words': 777}