Categorygithub.com/qdm12/reactserv
module
0.0.0-20201201190129-09f4b592f687
Repository: https://github.com/qdm12/reactserv.git
Documentation: pkg.go.dev

# README

Reactserv

HTTP server to serve React static files from memory. You can also set the root URL.

Build status Docker Pulls Docker Stars Image size Image version

Join Slack channel GitHub last commit GitHub commit activity GitHub issues

Features

  • Reads the static React files from disk and serves them from memory
  • Modify in-memory files with the ROOT_URL set, so using a reverse proxy is easier
  • Reloads files in memory on any file change (works on all platforms, and obviously Linux/Docker)
  • Compatible with amd64, 386, arm64, arm32v7, arm32v6, ppc64le and s390x CPU architectures
  • Docker image tags and sizes

Setup

  1. Place your compiled React code in a directory, for example /yourpath/react.

  2. Use the following command:

    docker run -d -p 8000:8000/tcp -v /yourpath/react:/srv:ro qmcgaw/reactserv
    

    You can also use docker-compose.yml with:

    docker-compose up -d
    
  3. You can update the image with docker pull qmcgaw/reactserv:latest or use one of tags available

Environment variables

Environment variableDefaultPossible valuesDescription
LOG_ENCODINGconsolejson, consoleLogging format
LOG_LEVELinfodebug, info, warning, errorLogging level
LISTENING_PORT8000Integer between 1 and 65535Internal listening TCP port
ROOT_URL/URL path stringURL path, used if behind a reverse proxy
ROOT_DIRsrvAbsolute or relative file pathRoot filesystem path to read files from
TZAmerica/MontrealstringTimezone

Development

  1. Setup your environment

    Using VSCode and Docker (easier)

    1. Install Docker
      • On Windows, share a drive with Docker Desktop and have the project on that partition
      • On OSX, share your project directory with Docker Desktop
    2. With Visual Studio Code, install the remote containers extension
    3. In Visual Studio Code, press on F1 and select Remote-Containers: Open Folder in Container...
    4. Your dev environment is ready to go!... and it's running in a container :+1: So you can discard it and update it easily!

    Locally

    1. Install Go, Docker and Git

    2. Install Go dependencies with

      go mod download
      
    3. Install golangci-lint

    4. You might want to use an editor such as Visual Studio Code with the Go extension. Working settings are already in .vscode/settings.json.

  2. Commands available:

    # Build the binary
    go build cmd/app/main.go
    # Test the code
    go test ./...
    # Lint the code
    golangci-lint run
    # Build the Docker image
    docker build -t qmcgaw/reactserv .
    
  3. See Contributing for more information on how to contribute to this repository.

TODOs

  • Add default favicon.ico
  • Authentication with OAuth or similar

License

This repository is under an MIT license unless otherwise indicated

# Packages

No description provided by the author