webserver

package module
v0.0.0-...-37e99e6 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 8 Imported by: 0

README

serve

serve -port 8080

CLI

Installation
go install github.com/nazhard/web-server/cmd/serve@latest
Usage
$ serve -log=false
# serve current directory and no cute log

$ serve -h
# print help

$ serve -dir dist -port 8080
# serve files inside "dir" and use 8080 as port

Use in your own projects

Installation
go get github.com/nazhard/web-server@latest
Usage
package main

import (
    "github.com/nazhard/web-server"
)

func main() {
    server := &webserver.New{
        Dir:  "path/to/static/assets",
        Port: "8080",
        Log:  true,
    }

    server.Start()
}

Why?

Just for test purposes. It's faster than pnpm preview you know.

My use case:

  • pnpm build
  • serve -dir dist

Yeah, just to see if everything is okay.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type New

type New struct {
	Dir  string
	Port string
	Log  bool
}

func (*New) Start

func (s *New) Start()

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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