Giter Site home page Giter Site logo

stupid-server's Introduction

stupid-server

A rock stupid command-line static file server, built with node/express.

Install it

npm install -g stupid-server

Use it

Usage: stupid-server [options] [path to serve]

 Options:

   -h, --help                          output usage information
   -f, --flatten                       flatten requests for html or directories to the server root.
   -h, --host [hostname]               set the host to listen on [localhost]
   -p, --port [portnum]                set the port to listen on [8080], [8443] with --secure
   -s, --secure                        use https with an automatically generated self-signed certificate
   -x, --proxy <path::destinationUrl>  proxy requests under path to destination
   -c, --cert [certPath]               path to a self-signed certificate to use for https
   -k, --key [keyPath]                 path to the key for the --cert certificate

 Notes:

   If no path is specified, the CWD will be used

   Multiple --proxy options can be specified

   The --flatten option is primarily useful for single page js apps that use
   the history api to create natural URIs rather than hash based routes

Notes

The flatten middleware may have issues when running under Windows, as it's using the path module for some URL path logic, because I'm lazy.

Generating self signed certs for use in making a "secure" local development server can be done in multiple ways. Using dev-cert-authority is pretty easy and straightforward. Use with stupid server by following the installation process for dev-cert-authority, then stupid-server -s -c $(dev-cert-authority path localdomain.io cert) -k $(dev-cert-authority path localdomain.io key)

Possibly Askable Questions

Why would you build such a thing?

I often just want to fool around with some client-side html/css/js, just to try out an idea. I don't want to jump through hoops to get the code in a browser, but I don't want to use codepen or jsfiddle either, as it may eventually evolve into someting more useful.

But X other thing already does this

Well, crap. Now I just feel stupid. Thanks.

Will you add feature Y?

Sure, as long as it's simple enough to set via a command line option.

stupid-server's People

Contributors

mattcheely avatar xdumaine 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.