Git Product home page Git Product logo

module.web's Introduction

Duct module.web

Build Status

A Duct module that adds a web server and useful middleware to a configuration. This is the basis of all web applications built with Duct.

Installation

To install, add the following to your project :dependencies:

[duct/module.web "0.7.0"]

Usage

To add this module to your configuration, add a reference to :duct.module.web/api if you want to develop a web service:

{:duct.core/project-ns foo
 :duct.module.web/api  {}}

Or :duct.module.web/site if you want to develop a user-facing web application:

{:duct.core/project-ns foo
 :duct.module.web/site {}}

Or :duct.module/web if you want the bare-bones approach and want to handle most things yourself.

Note that the :duct.core/project-ns key must also be set, to allow the module to find the right resources.

By default, the module uses the :duct.server.http/jetty key for the webserver, as supplied by the server.http.jetty library. However, if a key deriving from :duct.server/http already exists in the configuration, the module will use that instead.

Similarly, the module includes the :duct.router/cascading key for routing. This is a simple router that takes an ordered vector of handlers, and will return the first non-nil response for a given request.

For example:

{:duct.router/cascading [#ig/ref :foo.endpoint/example1
                         #ig/ref :foo.endpoint/example2]
 :foo.endpoint/example1 {}
 :foo.endpoint/example2 {}}

If a key deriving from :duct/router exists in the configuration already, then that is used instead.

License

Copyright © 2017 James Reeves

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

module.web's People

Contributors

benalbrecht avatar ikitommi avatar jaydeesimon avatar prepor avatar transducer avatar weavejester avatar

Watchers

 avatar

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.