Coder Social home page Coder Social logo

spark's Introduction

spark

Emergency web server

For those occasions when your webserver is down and you want to display a quick maintainance note. Or just want to quickly demo a static site. Or whatever :)

It can take a directory, a file or directly the body string. The -proxy flag can be useful when used as a development server.

❯ spark -h
Usage of spark:
  -address string
    	Listening address (default "0.0.0.0")
  -cert string
    	SSL certificate path (default "cert.pem")
  -contentType string
    	Set response Content-Type
  -corsHeaders string
    	Allowed CORS headers (default "Content-Type, Authorization, X-Requested-With")
  -corsMethods string
    	Allowd CORS methods (default "POST, GET, OPTIONS, PUT, DELETE")
  -corsOrigin string
    	Allow CORS request from this origin (can be '*')
  -deny string
    	Sensitive directory or file patterns to be denied when serving directory (comma separated)
  -key string
    	SSL private Key path (default "key.pem")
  -path string
    	URL path (default "/")
  -port string
    	Listening port (default "8080")
  -proxy string
    	URL prefixes to be proxied to another server e.g. /api=>http://localhost:3000 will forward all requests starting with /api to http://localhost:3000 (comma separated)
  -sslPort string
    	SSL listening port (default "10433")
  -status int
    	Returned HTTP status code (default 200)

install

  • from source
go get github.com/rif/spark

examples

$ spark message.html
$ spark "<h1>Out of order</h1><p>Working on it...</p>"
$ spark static_site/
$ spark -port 80 -sslPort 443 "<h1>Ooops!</h1>"
$ spark -deny ".git*,LICENSE" ~/go/rif/spark
$ spark -proxy "/api=>http://localhost:9090/api" .
$ spark -port 9000 -corsOrigin "https://www.mydomain.com" -contentType "application/json" '{"message":"Hello"}'

To quickly generate a ssl certificate run:

go run $GOROOT/src/crypto/tls/generate_cert.go --host="localhost"

spark's People

Contributors

inconnu08 avatar mickaelandrieu avatar msoap avatar nxtdev01 avatar paulanunda avatar pwaller avatar rif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spark's Issues

Unable to parse Build/KitchenChaosWebGLExport.framework.js.br

This is an extremely specific issue, and I don't know whether to expect it ever being addressed, but... just in case it can be and it makes sense to do so, I just wanted to test a unity webgl output using spark, and when loading through http://localhost:8080/ all I get is the following error:

image

Just in case you had motivation to work on this project and do something fun to support content encoding for files, y'know? ;)

Safe directory flag option

The default fileserver has no option to exclude sensitive dotfiles or directories, one option is to implement a custom filesystem considering the case

spark/spark.go

Line 41 in 8b891be

handler = http.StripPrefix(*path, http.FileServer(http.Dir(body)))

Add Safe directory flag option

The default fileserver has no option to exclude sensitive dotfiles or directories, one option is to implement a custom filesystem considering the case

spark/spark.go

Line 41 in 8b891be

handler = http.StripPrefix(*path, http.FileServer(http.Dir(body)))

Release artifacts

Hey there! Just came here from HN and noticed you offer a binary on the github page. It's usually not advised to keep binary parts (or anything auto-generated really) in your repository, so as an alternative you might consider something like github-release, if you're interested. Look at the README.md and the Makefile to see how you could make it work completely automatically ;).

Trojan on board?

Hi,

I have just downloaded spark_1.7.3_windows_amd64.tar.gz. It seems like there is something wrong with the included spark.exe. My virus scanner was complaining and some 29 out of 69 virus scanners on Virus Total think the same. What is going on here?

Take Care,
Z.

Purpose of the default "Spark!" message

First, great little program. Thanks for making it!

I had a question about running spark without any flags or arguments. It shows a message that says "Spark!" -- is this useful? What is its purpose?

If it isn't being used, I'd propose that the default behavior be equivalent to spark . - i.e. serve static files from the pwd.

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.