Skip to content

Commit 8c69936

Browse files
authored
Updates: Enhancements in framework (#15)
* Delete unused methods * use strings toLower * use constants from fasthttp * mention fasthttp in readme
1 parent eddd8be commit 8c69936

File tree

6 files changed

+17
-49
lines changed

6 files changed

+17
-49
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
</div>
1616

17-
A **Golang** framework for web development that keeps your web applications and services **alive** and responsive with its fast and lightweight design.
17+
A **Golang** framework for web development built on top of [Fasthttp](https://github.com/valyala/fasthttp) that keeps your web applications and services **alive** and responsive with its fast and lightweight design.
18+
1819
## Features
1920

2021
- Routing
@@ -33,6 +34,8 @@ Initialize your project ([Learn](https://go.dev/blog/using-go-modules)). Then in
3334
go get github.com/gopulse/pulse
3435
```
3536

37+
***It's require fasthttp v1.45.0***
38+
3639
### Getting Started
3740

3841
```go

constants/methods.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (c *Context) SetCookie(cookie *Cookie) {
120120
acCookie.SetExpire(cookie.Expires)
121121
}
122122

123-
switch utils.ToLower(cookie.SameSite) {
123+
switch strings.ToLower(cookie.SameSite) {
124124
case string(rune(fasthttp.CookieSameSiteStrictMode)):
125125
acCookie.SetSameSite(fasthttp.CookieSameSiteStrictMode)
126126
case string(rune(fasthttp.CookieSameSiteNoneMode)):

route.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package pulse
22

3-
import "github.com/gopulse/pulse/constants"
3+
import (
4+
"github.com/valyala/fasthttp"
5+
)
46

57
type route struct {
68
method string
@@ -24,45 +26,45 @@ func (r *route) Name() string {
2426

2527
// Get adds the route to the router with the GET method
2628
func (r *Router) Get(path string, handlers ...Handler) {
27-
r.add(constants.GetMethod, path, handlers)
29+
r.add(fasthttp.MethodGet, path, handlers)
2830
}
2931

3032
// Post adds the route to the router with the POST method
3133
func (r *Router) Post(path string, handlers ...Handler) {
32-
r.add(constants.PostMethod, path, handlers)
34+
r.add(fasthttp.MethodPost, path, handlers)
3335
}
3436

3537
// Put adds the route to the router with the PUT method
3638
func (r *Router) Put(path string, handlers ...Handler) {
37-
r.add(constants.PutMethod, path, handlers)
39+
r.add(fasthttp.MethodPut, path, handlers)
3840
}
3941

4042
// Delete adds the route to the router with the DELETE method
4143
func (r *Router) Delete(path string, handlers ...Handler) {
42-
r.add(constants.DeleteMethod, path, handlers)
44+
r.add(fasthttp.MethodDelete, path, handlers)
4345
}
4446

4547
// Patch adds the route to the router with the PATCH method
4648
func (r *Router) Patch(path string, handlers ...Handler) {
47-
r.add(constants.PatchMethod, path, handlers)
49+
r.add(fasthttp.MethodPatch, path, handlers)
4850
}
4951

5052
// Head adds the route to the router with the HEAD method
5153
func (r *Router) Head(path string, handlers ...Handler) {
52-
r.add(constants.HeadMethod, path, handlers)
54+
r.add(fasthttp.MethodHead, path, handlers)
5355
}
5456

5557
// Options adds the route to the router with the OPTIONS method
5658
func (r *Router) Options(path string, handlers ...Handler) {
57-
r.add(constants.OptionsMethod, path, handlers)
59+
r.add(fasthttp.MethodOptions, path, handlers)
5860
}
5961

6062
// Connect adds the route to the router with the CONNECT method
6163
func (r *Router) Connect(path string, handlers ...Handler) {
62-
r.add(constants.ConnectMethod, path, handlers)
64+
r.add(fasthttp.MethodConnect, path, handlers)
6365
}
6466

6567
// Trace adds the route to the router with the TRACE method
6668
func (r *Router) Trace(path string, handlers ...Handler) {
67-
r.add(constants.TraceMethod, path, handlers)
69+
r.add(fasthttp.MethodTrace, path, handlers)
6870
}

utils/strings.go

Lines changed: 0 additions & 7 deletions
This file was deleted.

utils/strings_test.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)