fserver

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

README

fserver

Build License Go Reference Go Report Card Release

Installation

go get -u github.com/no-src/fserver

Quick Start

package main

import (
	"embed"

	"github.com/no-src/fserver"
	"github.com/no-src/log"
)

// webDist the web dist resource
//
//go:embed dist
var webDist embed.FS

func main() {
	defer log.Close()

	exit, port := fserver.InitFlag(printVersion, printAboutInfo)
	if exit {
		return
	}
	fserver.Run(port, "/dist", webDist)
}

func printVersion() {
	log.Log("version info")
}
func printAboutInfo() {
	log.Log("about info")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitFlag

func InitFlag(versionFunc, aboutFunc func()) (exit bool, port int)

InitFlag init the default flags

func Run

func Run(port int, pathPrefix string, dist embed.FS)

Run start the static file web server

Types

This section is empty.

Jump to

Keyboard shortcuts

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