Giter Club home page Giter Club logo

simple-go-web-server's Introduction

Simple Go Web Server

Run your small or test project server by golang.

Features

  • golang web server
  • support .js file
  • hot reload

Uses

  1. git clone https://github.com/madeinfree/simple-go-web-server
  2. cd simple-go-web-server
  3. alias simple-go-web-server='$(pwd)/bin/simple-go-web-server'
  4. go to your website project directory
  5. command simple-go-web-server [options]
  6. open http://localhost:3000

Command Options

Options Type Description Default
--port, -p int setting web server listen port 3000
--content, -c string setting hot loader file content base null
--hot, -hh boolean should required when you use --content options false

Port

When you would like to set your website port you can command

simple-go-web-server -p 8080

to use 8080 port.

Hot Reload

simple go web server help allow you to use hot reload, you can command

$ simple-go-web-server -p 1234 -c "/build/bundle.js" --hot

and copy below script paste in your js file

setInterval(() => {
  fetch('http://localhost:3000/simple-go-server-file-change').then((r) => {
    r.json().then((rr) => {
      if (rr) {
        fetch('http://localhost:3000//simple-go-server-file-callback?isOK=true', {
          method: 'GET'
        })
        location.reload()
      }
    })
  })
}, 2000)

simple-go-web-server's People

Contributors

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