Coder Social home page Coder Social logo

serve's Introduction

serve

Dead simple localhost server.

Start serving the current folder at the first available port after 8080 and open the browser to the corresponding adress.

> serve
2022/07/07 14:31:44 [serve] Start serving the current folder at http://localhost:8080.
2022/07/07 14:31:44 [serve] Request: /

Or if there is piped data it will be served.

> echo test | serve
2022/07/07 14:33:46 [serve] Piped data is present.
2022/07/07 14:33:46 [serve] Start serving the current folder at http://localhost:8080.
2022/07/07 14:33:55 [serve] Request: /
2022/07/07 14:33:55 [serve] Serve piped data at root.

Only two flags are available:

  • -p : choose the port to use. If not set the first available after 8080 will be used.
    > serve -p 8888
    2022/07/07 14:34:56 [serve] Start serving the current folder at http://localhost:8888.
    2022/07/07 14:34:56 [serve] Request: /
  • -t : serve at the given path
    > serve -t 'foo'
    2022/07/07 14:36:54 [serve] Start serving at http://localhost:8080/foo/.
    2022/07/07 14:36:54 [serve] Request: /foo/

To install

Using go

> go install github.com/kpym/serve@latest

Downloading precompiled binaries

You can download the precompiled single executable from the realease page.

Using goreleaser

After cloning this repo you can compile the sources with goreleaser for all available platforms:

git clone https://github.com/kpym/lol.git .
goreleaser --snapshot --skip-publish --clean

You will find the resulting binaries in the dist/ sub-folder.

License

MIT for this code (but all used libraries may have different licences).

serve's People

Contributors

kpym 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.