Crates.io | swerve |
lib.rs | swerve |
version | 0.2.0 |
source | src |
created_at | 2017-10-18 14:21:20.443696 |
updated_at | 2018-04-16 14:43:55.872683 |
description | Quick and easy multithreaded file server for local front end development |
homepage | https://github.com/commander-lol/rust-swerve |
repository | https://github.com/commander-lol/rust-swerve |
max_upload_size | |
id | 36057 |
size | 57,958 |
Quick and easy multithreaded file server for local development
A common misconception about swerve is that the name is a play on the word "serve", as in the purpose of a file server. Contrary to this, swerve actually stands for "Simple Werve" - the goal being to make it super simple to werve your files from anywhere on the filesystem.
While swerve does nothing innovative, the goal is to have a fast performing file server with minimal set up and tear down time, as well as minimal request time spent inside the server itself. Current features are limited to serving files, but the roadmap includes API mocking to make front end development even easier.
swerve
somewhere in your $PATH
, or modify your $PATH
to inlcude the folder containing swerve
cd
to the folder containing your files and run swerve
cd "$HOME/projects/my_awesome_site"
swerve
swerve
, specifying your target directory
swerve -d "$HOME/projects/my_awesome_site"
To build and install swerve from source, you will need rustc 1.22.0-nightly
or later as well as the Cargo package
manager
cargo install swerve
This will build a copy of swerve on your local machine in case there isn't a binary built for your platform. A little bit anticlimactic, but pretty simple.
You can print out the usage text at any time by running swerve -h
or swerve --help
. The currently supported options
are:
Option | Param | Description | Notes |
---|
-h
, --help
| | Print out the help text |
-d
, --dir
| path; string
| Use the target directory as the root for serving files | File paths are jailed, and will not be able to escape the root directory. Defaults to the directory in which the swerve
command was run
-p
, --port
| port; unsigned int
| Run the server listening on the given port | Defaults to 8200
-a
, --address
| address; string
| Bind the server to this network address, allowing remote connections | Defaults to localhost
, preventing remote connections
-t
, --threads
| thread count; unsigned int
| Create this number of threads in the thread pool, to use for serving files concurrently | Defaults to 32
. Performance may be improved on lower end machines by decreasing the number of worker threads
-q
, --quiet
| | Don't print anything to stdout | Useful if you're spawning swerve from another process and need to monitor stdout
--no-index
| | Don't attempt to serve an index.html
file from a directory path | By default, swerve will treat directories as requests for an index.html
file. e.g. /foo/bar
is treated as /foo/bar/index.html