All Projects → pandeiro → Boot Http

pandeiro / Boot Http

A simple HTTP serve task for the Boot build tool

Programming Languages

clojure
4091 projects

Projects that are alternatives of or similar to Boot Http

1line Py
Enseñando pensamiento computacional a partir de python one-liners
Stars: ✭ 45 (-25%)
Mutual labels:  development
Laravel Packager
A cli tool for creating Laravel packages
Stars: ✭ 1,049 (+1648.33%)
Mutual labels:  development
Iconology
I got tired of manually exporting every icon size (for Xcode and more), so I made an app to do it.
Stars: ✭ 56 (-6.67%)
Mutual labels:  development
Secure Boot
UEFI SecureBoot for ArchLinux
Stars: ✭ 48 (-20%)
Mutual labels:  boot
Ready For Tech Interview
💻 신입 개발자로서 준비를 하기 위해 지식을 정리하는 공간 👨‍💻
Stars: ✭ 1,035 (+1625%)
Mutual labels:  development
Kotlin Android Scaffolding
An android project structure using kotlin and most common libraries.
Stars: ✭ 53 (-11.67%)
Mutual labels:  development
Pmbootstrap
Repository has been moved! https://postmarketos.org/move.html#/pmbootstrap 🚚 🚚 🚚
Stars: ✭ 1,010 (+1583.33%)
Mutual labels:  boot
Spring Cloud Stream Demo
Simple Event Driven Microservices with Spring Cloud Stream
Stars: ✭ 58 (-3.33%)
Mutual labels:  boot
Webthings
A collection of all things web, because my memory sucks and so does yours.
Stars: ✭ 50 (-16.67%)
Mutual labels:  development
Bootstrap
Tools to bootstrap micro computers
Stars: ✭ 55 (-8.33%)
Mutual labels:  boot
Debootstick
Generate a bootable live image from any Debian/Ubuntu filesystem tree.
Stars: ✭ 48 (-20%)
Mutual labels:  boot
Kn
A collection of shell functions for Kubernetes native dabbling
Stars: ✭ 49 (-18.33%)
Mutual labels:  development
Boot Cljs Test
Boot task to run ClojureScript tests.
Stars: ✭ 53 (-11.67%)
Mutual labels:  boot
Tutorials
Stars: ✭ 47 (-21.67%)
Mutual labels:  development
Gdbstub
A simple, dependency-free GDB stub that can be easily dropped in to your project.
Stars: ✭ 56 (-6.67%)
Mutual labels:  development
Influx Prompt
An interactive command-line InfluxDB cli with auto completion.
Stars: ✭ 42 (-30%)
Mutual labels:  development
Boot Figreload
Boot task providing live-reload using Fighweel client
Stars: ✭ 50 (-16.67%)
Mutual labels:  boot
Http Prompt
An interactive command-line HTTP and API testing client built on top of HTTPie featuring autocomplete, syntax highlighting, and more. https://twitter.com/httpie
Stars: ✭ 8,329 (+13781.67%)
Mutual labels:  development
Ansible Osx Command Line Tools
An Ansible role for installing OS X Command Line Tools
Stars: ✭ 57 (-5%)
Mutual labels:  development
Awesome Osx
📦 Awesome stuff for OSX
Stars: ✭ 54 (-10%)
Mutual labels:  development

boot-http Build Status

A simple HTTP serve task for use with the boot build tool that can serve resources, directories or a typical ring handler.

[pandeiro/boot-http "0.8.3"] ;; latest release

Usage

(The following examples assume you have boot installed and updated.)

Command line, no setup

This serves the current directory at port 3000:

boot -d pandeiro/boot-http serve -d . wait

To inspect the meanings of the flags and other tasks, use boot's built-in documentation mechanism:

boot -d pandeiro/boot-http -h       # show all tasks on the classpath
boot -d pandeiro/boot-http serve -h # show serve's usage

Within a project

If you already have a build.boot, add pandeiro/boot-http to :dependencies and (require '[pandeiro.boot-http :refer :all]).

You can use boot-http for three different use cases:

1. Serve classpath resources

boot serve wait   # or from REPL: (boot (serve) (wait))

2. Serve files on chosen directory

boot serve -d target wait   # or at the REPL: (boot (serve :dir "target") (wait))

That would serve the target directory if it exists.

Instead of specifying a directory, you can also specify a ring handler:

3. Start server with given Ring handler

boot serve -H myapp.server/app -R wait   # (boot (serve :handler 'myapp.server/app :reload true) (wait))

Note: boot-http will automatically wrap responses in middlewares to add content type and charset (see --charset option) to response headers.

Composability

You may have noticed the wait task being used after all the command-line invocations so far. This is because by itself, the serve task does not block and thus exits immediately.

What good is that? It means you can compose with other tasks.

In boot-cljs-example, for example, serve is invoked like so:

boot serve watch speak reload cljs-repl cljs -usO none

which is, again, the same as:

(comp (serve)
      (watch)
      (speak)
      (reload)
      (cljs-repl)
      (cljs :optimizations :none))

In that case, since serve is given a directory, it serves the directory and whatever resources can be found on the classpath, and then gets out of the way.

Other options

-p / --port

Use a specific port. A value of 0 will automatically bind to a free port. The actual port number being used is available as :http-port on the fileset.

boot -d pandeiro/boot-http serve -d . -p 8888 wait

-k / --httpkit

Use the HTTP Kit webserver instead of Jetty.

boot -d pandeiro/boot-http serve -d . -k wait  # uses httpkit

-n / --nrepl

Start an nREPL server for access to the http server. Accepts :port and :bind options for setting nREPL server IP and port.

boot -d pandeiro/boot-http serve -d . -n "{:port 3001}"

-i / --init and -c / --cleanup

Setup and teardown functions to run.

-s / --silent

Silences all output.

-R / --reload

Wrap provided ring handler with ring-reload.

-N / --not-found

Use the provided symbol's function to handle requests for results that are not found.

boot serve -d target -N myapp.server/custom-not-found wait

-S / --charset

Charset to use when serving resources or files. Defaults to UTF-8.

-t / --ssl

Serve over HTTPS (see -T / --ssl-props as well): Jetty only.

API and Roadmap

Right now that is about it. It basically blends the functionality of python3 -m http.server and a subset of lein ring server.

Feel free to add issues or comment here if you have any ideas.

Acknowledgements

The boot guys basically wrote all of this or walked me through any parts I had to change. Thanks!

License

Copyright © 2015 Murphy McMahon

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].