Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kachayev/nasus
Zero-configuration command-line async HTTP files server in Clojure. Like Python's SimpleHTTPServer but scalable.
https://github.com/kachayev/nasus
async clojure http http-server netty static-server
Last synced: 5 days ago
JSON representation
Zero-configuration command-line async HTTP files server in Clojure. Like Python's SimpleHTTPServer but scalable.
- Host: GitHub
- URL: https://github.com/kachayev/nasus
- Owner: kachayev
- License: mit
- Created: 2019-03-04T13:09:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-28T17:26:30.000Z (almost 3 years ago)
- Last Synced: 2024-03-14T20:04:54.599Z (8 months ago)
- Topics: async, clojure, http, http-server, netty, static-server
- Language: Clojure
- Size: 84 KB
- Stars: 166
- Watchers: 8
- Forks: 9
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nasus HTTP Server
A simple zero-configuration command-line HTTP files server. Like Python's `SimpleHTTPServer` but scalable. Сan easily handle thousands of simultaneous connections.
Implemented in `Clojure` with [`Aleph`](https://github.com/ztellman/aleph) and [`Netty`](https://github.com/netty/netty). Mostly as an example. It's still skillful and handy tho'. There's even nothing wrong with putting it to production.
## Usage
Run in the directory you want to serve:
```shell
clj -Sdeps '{:deps {nasus {:mvn/version "0.1.7"}}}' -m http.server
```Or specify custom port:
```shell
clj -Sdeps '{:deps {nasus {:mvn/version "0.1.7"}}}' -m http.server 8001
```## Features
* Plain text & HTML directory listings based on "Accept" header
* Automatic mime-type detection
* Streaming and chunked encoding for large files
* Keep-alive and slow requests handling
* Transparent content compression (gzip, deflate)
* Cache control and "Last-Modified"
* CORS headersIn development:
* Range queries support
* SSL/TLS
* List of files & directories to exclude from serving## Flags
```
-p, --port 8000 Port number
-b, --bind 0.0.0.0 Address to bind to
--dir ./ Directory to serve files
--auth Basic auth
--no-index Disable directory listings
--no-cache Disable cache headers
--no-compression Disable deflate and gzip compression
--follow-symlink Enable symbolic links support
--include-hidden Process hidden files as normal
--cors Support Acccess-Control-* headers, see --cors-* options for more fine-grained control
--cors-origin Acccess-Control-Allow-Origin response header value
--cors-methods Acccess-Control-Allow-Methods response header value
--cors-allow-headers Acccess-Control-Allow-Headers response header value
--index-document-path When requesting "dir/", respond with "dir/" instead of a listing
-h, --help
```## License
Copyright © 2020 Nasus
Nasus is licensed under the MIT license, available at MIT and also in the LICENSE file.