-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from savsgio/develop
- Added more types of response - Refactor of project structure - Fixes and improvements
- Loading branch information
Showing
7 changed files
with
164 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package atreugo | ||
|
||
const network = "tcp4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package atreugo | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/erikdubbelboer/fasthttp" | ||
"github.com/savsgio/go-logger" | ||
"github.com/thehowl/fasthttprouter" | ||
) | ||
|
||
// private | ||
|
||
type pools struct { | ||
filePool sync.Pool | ||
readerPool sync.Pool | ||
} | ||
|
||
// public | ||
|
||
// Config config for Atreugo | ||
type Config struct { | ||
Host string | ||
Port int | ||
LogLevel string | ||
Compress bool | ||
TLSEnable bool | ||
CertKey string | ||
CertFile string | ||
GracefulEnable bool | ||
} | ||
|
||
// Atreugo struct for make up a server | ||
type Atreugo struct { | ||
server *fasthttp.Server | ||
router *fasthttprouter.Router | ||
middlewares []Middleware | ||
log *logger.Logger | ||
cfg *Config | ||
} | ||
|
||
// View must process incoming requests. | ||
type View func(ctx *fasthttp.RequestCtx) error | ||
|
||
// Middleware must process all incoming requests before defined views. | ||
type Middleware func(ctx *fasthttp.RequestCtx) (int, error) | ||
|
||
// JSON is a map whose key is a string and whose value an interface | ||
type JSON map[string]interface{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters