Giter VIP home page Giter VIP logo

http-server-rs's Introduction

http-server: a simple static HTTP server 🚀🦀

Rewrite of the popular npm package http-server in Rust with some extras included.

http-server is a simple, zero-configuration command-line static HTTP server. It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development and learning.

Usage

# Use default configuration
http-server

# Arguments
http-server --no-cache --cors ./public

# Custom Headers
http-server -H Cross-Origin-Opener-Policy:same-origin
Usage: http-server [OPTIONS] [SERVE_DIR]

Arguments:
  [SERVE_DIR]  Target directory to serve [default: ./dist]

Options:
  -a, --address <ADDRESS>        [default: 0.0.0.0]
  -p, --port <PORT>              [default: 8080]
  -c, --cache-time <CACHE_TIME>  Cache control time [default: 3600]
  -H, --header <HEADERS>         Custom headers (Format "key:value")
      --cors                     Enable CORS header
      --no-cache                 Disable cache control header
  -Q, --quiet                    Don't print any logs to terminal
  -h, --help                     Print help

Installation

MacOS & Linux

Install & Update Script

This will prompt you for the install path, run it again to update the version

curl -s "https://raw.githubusercontent.com/alshdavid/http-server-rs/main/scripts/install.sh" | sh

Manual

Download the binary from the latest GitHub release and add it to your PATH

# Linux AMD64
curl -L --url https://github.com/alshdavid/http-server-rs/releases/latest/download/linux-amd64.tar.gz | tar -xvzf - -C $HOME/.local/bin --strip-components=1

# Linux ARM64
curl -L --url https://github.com/alshdavid/http-server-rs/releases/latest/download/linux-arm64.tar.gz | tar -xvzf - -C $HOME/.local/bin --strip-components=1

# MacOS ARM64 (Apple Silicon)
curl -L --url https://github.com/alshdavid/http-server-rs/releases/latest/download/macos-arm64.tar.gz | tar -xvzf - -C $HOME/.local/bin --strip-components=1

# MacOS AMD64 (Intel)
curl -L --url https://github.com/alshdavid/http-server-rs/releases/latest/download/macos-amd64.tar.gz | tar -xvzf - -C $HOME/.local/bin --strip-components=1

# Add to PATH if not already there:
echo "\nexport \PATH=\$PATH:\$HOME/.local/bin\n" >> $HOME/.zshrc
echo "\nexport \PATH=\$PATH:\$HOME/.local/bin\n" >> $HOME/.bashrc

Windows

Download the binary from the latest GitHub release and add it to your PATH

http-server-rs's People

Contributors

alshdavid avatar

Stargazers

Hlöðver Sigurðsson 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.