net/http backend template¶
Package net
provides a portable interface for network I/O, including TCP/IP, UDP, domain name resolution, and Unix domain sockets. Package net/http provides HTTP client and server implementations.
- Create a new project:
cgapp create
- Run project by this command:
task -s
What's task
command?
We're using Taskfile
1 as task manager for running project on a local machine by default.
.
├── .dockerignore
├── .editorconfig
├── .gitignore
├── Dockerfile
├── Taskfile.yml
├── go.mod
├── go.sum
├── main.go
├── configs
│ └── apiserver.yml
├── static
│ └── index.html
└── pkg
└── apiserver
├── config.go
├── config_test.go
├── error_checker.go
├── error_checker_test.go
├── new_server.go
├── new_server_test.go
├── utils.go
├── utils_test.go
└── routes.go
4 directories, 17 files
# ./configs/apiserver.yml
# Server config
server:
host: 0.0.0.0
port: 5000
# Database config
database:
host: 127.0.0.1
port: 5432
username: postgres
password: 1234
# Static files config
static:
prefix: /
path: ./static
- gorilla/mux
v1.7.4
- go-yaml/yaml
v2.3.0
- Template source code: github.com/create-go-app/net_http-go-template
- Author, maintainer: Vic Shóstak