Code Monkey home page Code Monkey logo

rust-swerve's Introduction

Swerve

Quick and easy multithreaded file server for local development

Build Status License Version Number

About

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.

Installation

Prebuilt

  1. Download the binary for your OS from the releases page
    • swerve.x86_64-unknown-linux-gnu = Generic Linux
    • swerve.x86_64-apple-darwin = macOS
  2. Rename the binary to swerve
  3. Put swerve somewhere in your $PATH, or modify your $PATH to inlcude the folder containing swerve
  4. Do one of two things:
    1. Open up a command prompt and cd to the folder containing your files and run swerve
      cd "$HOME/projects/my_awesome_site"
      swerve
    2. Open up a command prompt and run swerve, specifying your target directory
      swerve -d "$HOME/projects/my_awesome_site"

From source

To build and install swerve from source, you will need rustc 1.27.0-nightly or later as well as the Cargo package manager

  1. In a command prompt, run 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.

Usage

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
-u, --upload Accept form uploads via a POST request to the /uploads endpoint The file_handling and field_handling config value affect how forms are handled. Setting them to Log or File will log the values or write them to disk respectively
-U, --upload-path path; string Accept form uploads via a POST request to the specified endpoint See the --upload option for information on configuration
--license Print out the GPL 3 license text GPL compliance is cool, kids

rust-swerve's People

Contributors

commander-lol 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.