@@ -29,8 +29,8 @@ const Version = "1.8.43"
2929// Map is a shortcut for map[string]interface{}
3030type Map map [string ]interface {}
3131
32- // Fiber denotes the Fiber application.
33- type Fiber struct {
32+ // App denotes the Fiber application.
33+ type App struct {
3434 server * fasthttp.Server // FastHTTP server
3535 routes []* Route // Route stack
3636 Settings * Settings // Fiber settings
@@ -67,15 +67,15 @@ type Settings struct {
6767// Group struct
6868type Group struct {
6969 prefix string
70- app * Fiber
70+ app * App
7171}
7272
7373// Global variables
7474var isPrefork , isChild bool
7575
7676// New creates a new Fiber named instance.
7777// You can pass optional settings when creating a new instance.
78- func New (settings ... * Settings ) * Fiber {
78+ func New (settings ... * Settings ) * App {
7979 // Parse arguments
8080 for _ , v := range os .Args [1 :] {
8181 if v == "-prefork" {
@@ -85,7 +85,7 @@ func New(settings ...*Settings) *Fiber {
8585 }
8686 }
8787 // Create app
88- app := new (Fiber )
88+ app := new (App )
8989 // Create settings
9090 app .Settings = new (Settings )
9191 // Set default settings
@@ -109,7 +109,7 @@ func New(settings ...*Settings) *Fiber {
109109}
110110
111111// Group is used for Routes with common prefix to define a new sub-router with optional middleware.
112- func (app * Fiber ) Group (prefix string , handlers ... func (* Ctx )) * Group {
112+ func (app * App ) Group (prefix string , handlers ... func (* Ctx )) * Group {
113113 if len (handlers ) > 0 {
114114 app .registerMethod ("USE" , prefix , handlers ... )
115115 }
@@ -139,15 +139,15 @@ type Static struct {
139139}
140140
141141// Static registers a new route with path prefix to serve static files from the provided root directory.
142- func (app * Fiber ) Static (prefix , root string , config ... Static ) * Fiber {
142+ func (app * App ) Static (prefix , root string , config ... Static ) * App {
143143 app .registerStatic (prefix , root , config ... )
144144 return app
145145}
146146
147147// Use registers a middleware route.
148148// Middleware matches requests beginning with the provided prefix.
149149// Providing a prefix is optional, it defaults to "/"
150- func (app * Fiber ) Use (args ... interface {}) * Fiber {
150+ func (app * App ) Use (args ... interface {}) * App {
151151 var path = ""
152152 var handlers []func (* Ctx )
153153 for i := 0 ; i < len (args ); i ++ {
@@ -165,61 +165,61 @@ func (app *Fiber) Use(args ...interface{}) *Fiber {
165165}
166166
167167// Connect : https://fiber.wiki/application#http-methods
168- func (app * Fiber ) Connect (path string , handlers ... func (* Ctx )) * Fiber {
168+ func (app * App ) Connect (path string , handlers ... func (* Ctx )) * App {
169169 app .registerMethod (MethodConnect , path , handlers ... )
170170 return app
171171}
172172
173173// Put : https://fiber.wiki/application#http-methods
174- func (app * Fiber ) Put (path string , handlers ... func (* Ctx )) * Fiber {
174+ func (app * App ) Put (path string , handlers ... func (* Ctx )) * App {
175175 app .registerMethod (MethodPut , path , handlers ... )
176176 return app
177177}
178178
179179// Post : https://fiber.wiki/application#http-methods
180- func (app * Fiber ) Post (path string , handlers ... func (* Ctx )) * Fiber {
180+ func (app * App ) Post (path string , handlers ... func (* Ctx )) * App {
181181 app .registerMethod (MethodPost , path , handlers ... )
182182 return app
183183}
184184
185185// Delete : https://fiber.wiki/application#http-methods
186- func (app * Fiber ) Delete (path string , handlers ... func (* Ctx )) * Fiber {
186+ func (app * App ) Delete (path string , handlers ... func (* Ctx )) * App {
187187 app .registerMethod (MethodDelete , path , handlers ... )
188188 return app
189189}
190190
191191// Head : https://fiber.wiki/application#http-methods
192- func (app * Fiber ) Head (path string , handlers ... func (* Ctx )) * Fiber {
192+ func (app * App ) Head (path string , handlers ... func (* Ctx )) * App {
193193 app .registerMethod (MethodHead , path , handlers ... )
194194 return app
195195}
196196
197197// Patch : https://fiber.wiki/application#http-methods
198- func (app * Fiber ) Patch (path string , handlers ... func (* Ctx )) * Fiber {
198+ func (app * App ) Patch (path string , handlers ... func (* Ctx )) * App {
199199 app .registerMethod (MethodPatch , path , handlers ... )
200200 return app
201201}
202202
203203// Options : https://fiber.wiki/application#http-methods
204- func (app * Fiber ) Options (path string , handlers ... func (* Ctx )) * Fiber {
204+ func (app * App ) Options (path string , handlers ... func (* Ctx )) * App {
205205 app .registerMethod (MethodOptions , path , handlers ... )
206206 return app
207207}
208208
209209// Trace : https://fiber.wiki/application#http-methods
210- func (app * Fiber ) Trace (path string , handlers ... func (* Ctx )) * Fiber {
210+ func (app * App ) Trace (path string , handlers ... func (* Ctx )) * App {
211211 app .registerMethod (MethodTrace , path , handlers ... )
212212 return app
213213}
214214
215215// Get : https://fiber.wiki/application#http-methods
216- func (app * Fiber ) Get (path string , handlers ... func (* Ctx )) * Fiber {
216+ func (app * App ) Get (path string , handlers ... func (* Ctx )) * App {
217217 app .registerMethod (MethodGet , path , handlers ... )
218218 return app
219219}
220220
221221// All matches all HTTP methods and complete paths
222- func (app * Fiber ) All (path string , handlers ... func (* Ctx )) * Fiber {
222+ func (app * App ) All (path string , handlers ... func (* Ctx )) * App {
223223 app .registerMethod ("ALL" , path , handlers ... )
224224 return app
225225}
@@ -325,7 +325,7 @@ func (grp *Group) All(path string, handlers ...func(*Ctx)) *Group {
325325
326326// Listen serves HTTP requests from the given addr or port.
327327// You can pass an optional *tls.Config to enable TLS.
328- func (app * Fiber ) Listen (address interface {}, tlsconfig ... * tls.Config ) error {
328+ func (app * App ) Listen (address interface {}, tlsconfig ... * tls.Config ) error {
329329 addr , ok := address .(string )
330330 if ! ok {
331331 port , ok := address .(int )
@@ -370,7 +370,7 @@ func (app *Fiber) Listen(address interface{}, tlsconfig ...*tls.Config) error {
370370// Make sure the program doesn't exit and waits instead for Shutdown to return.
371371//
372372// Shutdown does not close keepalive connections so its recommended to set ReadTimeout to something else than 0.
373- func (app * Fiber ) Shutdown () error {
373+ func (app * App ) Shutdown () error {
374374 if app .server == nil {
375375 return fmt .Errorf ("Server is not running" )
376376 }
@@ -379,7 +379,7 @@ func (app *Fiber) Shutdown() error {
379379
380380// Test is used for internal debugging by passing a *http.Request.
381381// Timeout is optional and defaults to 200ms, -1 will disable it completely.
382- func (app * Fiber ) Test (request * http.Request , msTimeout ... int ) (* http.Response , error ) {
382+ func (app * App ) Test (request * http.Request , msTimeout ... int ) (* http.Response , error ) {
383383 timeout := 200
384384 if len (msTimeout ) > 0 {
385385 timeout = msTimeout [0 ]
@@ -426,7 +426,7 @@ func (app *Fiber) Test(request *http.Request, msTimeout ...int) (*http.Response,
426426}
427427
428428// Sharding: https://www.nginx.com/blog/socket-sharding-nginx-release-1-9-1/
429- func (app * Fiber ) prefork (address string ) (ln net.Listener , err error ) {
429+ func (app * App ) prefork (address string ) (ln net.Listener , err error ) {
430430 // Master proc
431431 if ! isChild {
432432 addr , err := net .ResolveTCPAddr ("tcp" , address )
@@ -474,7 +474,7 @@ func (dl *disableLogger) Printf(format string, args ...interface{}) {
474474 // fmt.Println(fmt.Sprintf(format, args...))
475475}
476476
477- func (app * Fiber ) newServer () * fasthttp.Server {
477+ func (app * App ) newServer () * fasthttp.Server {
478478 return & fasthttp.Server {
479479 Handler : app .handler ,
480480 Name : app .Settings .ServerHeader ,
0 commit comments