Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sumukha-pk/basic-golang-server
A re-usable piece of code for creating a simple Go server
https://github.com/sumukha-pk/basic-golang-server
go golang golang-library golang-package server
Last synced: 16 days ago
JSON representation
A re-usable piece of code for creating a simple Go server
- Host: GitHub
- URL: https://github.com/sumukha-pk/basic-golang-server
- Owner: SUMUKHA-PK
- License: mit
- Created: 2019-06-15T04:43:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-25T00:40:23.000Z (over 1 year ago)
- Last Synced: 2024-06-19T20:49:23.534Z (5 months ago)
- Topics: go, golang, golang-library, golang-package, server
- Language: Go
- Homepage:
- Size: 26.5 MB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Basic-Golang-Server AND Proxy (Reverse)
## 1. The simple server
This is a simple Go server that can be the skeleton for all your servers you build.Key features:
* Uses gorilla mux for routing.
* Can provide custom routing functions which are of type \*mux.Router
* Can provide custom ports to create server.
* Uses go.mod, so just include *github.com/SUMUKHA-PK/Basic-Golang-Server* in your imports to get GOing.
* Client tracking feature in built in the server. This can be used to keep a track of connections in the server and operate accordingly.Usage:
```
import (
.
.
"github.com/SUMUKHA-PK/Basic-Golang-Server/server"
.
.
)func main(){
.
.
m := make(map[string]int)
r = routing.SetupRouting(r)
serverData = server.Data{
Router: r,
Port: "55555",
HTTPS: false,
ConnectionMap: m,
}err := server.Server(serverData)
if err != nil {
log.Fatalf("Could not start server : %v", err)
}
.
.
}
```## 2. The proxy :
The idea of the proxy (reverse proxy) is to be able to host it as a separate server with its own routing.
The server has separate API end points which when hit will allow us to add or remove servers from the
proxy!Since they all are independently managed, all servers can be independently started or shut down and added to
the proxy easily using some simple code, which can be in any language! (Or just cURL or wget commands)Further plans are to provide support to the proxy and the servers which enable the the servers to accept the
request ONLY through the proxy to increase security in the servers.PS: Contributions and thoughts on how to improve/ add more features is appreciated!