staticserver

command module
v0.0.0-...-99388ea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2022 License: MIT Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

staticserver

Simple server for static files

Install

go install github.com/digitalcircle-com-br/staticserver

Usage

call staticserver, it will start serving http from static folder inside present folder

Client Side Config

To make easier to use the same project in different contexts, a config file may be forwarded to the clients, calling the __config path at static server top level.

This feature relies on the existence of a file called config.yaml, with the following format:

"localhost:8080":
  a: "ASD"
  b: "123"
  c: 1
  d:
    da: da
    db: 23
"api.domain.com/apinst":
  a: "ASD"
  b: "123"
  c: 1
  d:
    da: da
    db: 23    

It will resolve which object to return as json based on host and url received for this request.

Sample output

{
    "__host":"localhost:8080",
    "__key":"localhost:8080",
    "__url":"/__config",
    "a":"ASD",
    "b":"123",
    "c":1,
    "d":{
        "da":"da",
        "db":23
    }
}

Please note __host, __key and __url will be added to be response object, to help debugging later.

An optional object called "*" may be provided in your yaml file, to be the fallback

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址