Skip to content

Commit

Permalink
Updates: Enhancements in framework (#15)
Browse files Browse the repository at this point in the history
* Delete unused methods

* use strings toLower

* use constants from fasthttp

* mention fasthttp in readme
  • Loading branch information
2hmad authored Apr 17, 2023
1 parent eddd8be commit 8c69936
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 49 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

</div>

A **Golang** framework for web development that keeps your web applications and services **alive** and responsive with its fast and lightweight design.
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.

## Features

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

***It's require fasthttp v1.45.0***

### Getting Started

```go
Expand Down
13 changes: 0 additions & 13 deletions constants/methods.go

This file was deleted.

2 changes: 1 addition & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (c *Context) SetCookie(cookie *Cookie) {
acCookie.SetExpire(cookie.Expires)
}

switch utils.ToLower(cookie.SameSite) {
switch strings.ToLower(cookie.SameSite) {
case string(rune(fasthttp.CookieSameSiteStrictMode)):
acCookie.SetSameSite(fasthttp.CookieSameSiteStrictMode)
case string(rune(fasthttp.CookieSameSiteNoneMode)):
Expand Down
22 changes: 12 additions & 10 deletions route.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package pulse

import "github.com/gopulse/pulse/constants"
import (
"github.com/valyala/fasthttp"
)

type route struct {
method string
Expand All @@ -24,45 +26,45 @@ func (r *route) Name() string {

// Get adds the route to the router with the GET method
func (r *Router) Get(path string, handlers ...Handler) {
r.add(constants.GetMethod, path, handlers)
r.add(fasthttp.MethodGet, path, handlers)
}

// Post adds the route to the router with the POST method
func (r *Router) Post(path string, handlers ...Handler) {
r.add(constants.PostMethod, path, handlers)
r.add(fasthttp.MethodPost, path, handlers)
}

// Put adds the route to the router with the PUT method
func (r *Router) Put(path string, handlers ...Handler) {
r.add(constants.PutMethod, path, handlers)
r.add(fasthttp.MethodPut, path, handlers)
}

// Delete adds the route to the router with the DELETE method
func (r *Router) Delete(path string, handlers ...Handler) {
r.add(constants.DeleteMethod, path, handlers)
r.add(fasthttp.MethodDelete, path, handlers)
}

// Patch adds the route to the router with the PATCH method
func (r *Router) Patch(path string, handlers ...Handler) {
r.add(constants.PatchMethod, path, handlers)
r.add(fasthttp.MethodPatch, path, handlers)
}

// Head adds the route to the router with the HEAD method
func (r *Router) Head(path string, handlers ...Handler) {
r.add(constants.HeadMethod, path, handlers)
r.add(fasthttp.MethodHead, path, handlers)
}

// Options adds the route to the router with the OPTIONS method
func (r *Router) Options(path string, handlers ...Handler) {
r.add(constants.OptionsMethod, path, handlers)
r.add(fasthttp.MethodOptions, path, handlers)
}

// Connect adds the route to the router with the CONNECT method
func (r *Router) Connect(path string, handlers ...Handler) {
r.add(constants.ConnectMethod, path, handlers)
r.add(fasthttp.MethodConnect, path, handlers)
}

// Trace adds the route to the router with the TRACE method
func (r *Router) Trace(path string, handlers ...Handler) {
r.add(constants.TraceMethod, path, handlers)
r.add(fasthttp.MethodTrace, path, handlers)
}
7 changes: 0 additions & 7 deletions utils/strings.go

This file was deleted.

17 changes: 0 additions & 17 deletions utils/strings_test.go

This file was deleted.

0 comments on commit 8c69936

Please sign in to comment.