repositorypackage
0.0.0-20240222151233-e4dcdf75c358
Repository: https://github.com/chriswalker/simplesrv.git
Documentation: pkg.go.dev
# README
simplesrv
simplesrv
is a Go project template for a bare-bones HTTP server, with a basic layered architecture, a backing database (SQLite) and basic unit tests in a few places - not comprehensive, but enough to get things going when starting up a new templated project.
Building and running simplesrv
The run.sh
Bash script takes the place of excessive Makefiles. To build:
$ ./run.sh build
which results in the simplesrv
binary being built into the bin/
directory.
$ ./run.sh run
will run the server, by default on port 8080 and using an SQL database file called app.db
.
For a list of tasks in the Run script, run:
$ ./run.sh help
Note the only third-party dependency is golangci-lint for the lint
task.
Using as a project template
-
Install
gonew
:$ go install golang.org/x/tools/cmd/gonew@latest
(see here for more information)
-
Then checkout
simplesrv
as a new templated project by:$ gonew github.com/chriswalker/simplesrv example/mysrv $ cd ./mysrv # aaaand work away