Home

Awesome

<p align="center"> <img src="https://user-images.githubusercontent.com/32125808/231166226-c636f344-fc3b-4c71-9181-49fe97491127.png" width="320px"> </p> <div align="center">

Go Report Card GitHub license Go Reference Go Doc Discord Online codecov CircleCI

</div>

A Golang framework for web development that keeps your web applications and services responsive with its fast and lightweight design.

Features

Installation

Make sure you have Go installed on your machine. Then run the following command:

Initialize your project (Learn). Then install Pulse with the go get command:

go get github.com/gopulse/pulse

Benchmarks :zap:

This test was performed by Go Web.

<img src="https://user-images.githubusercontent.com/32125808/234717844-d7bf69f8-11cb-420f-bd58-30a38769614e.png" alt="pulse framework pipeline benchmark">

Getting Started

package main

import (
	"github.com/gopulse/pulse"
)

func main() {
	app := pulse.New()
	router := pulse.NewRouter()

	app.Router = router

	router.Get("/", func(c *pulse.Context) error {
		c.String("Hello, World!")
		return nil
	})

	app.Run(":3000")
}

Examples

Supports GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD, CONNECT, TRACE

package main

import (
	"github.com/gopulse/pulse"
)

func main() {
    app := pulse.New()
    router := pulse.NewRouter()
    
    // GET /hello
    router.Get("/", func(c *pulse.Context) error {
        c.String("Hello, World!")
        return nil
    })
    
    // GET /hello/:name
    router.Get("/profile/:id", func(c *pulse.Context) error {
        c.String("Profile: " + c.Param("id"))
        return nil
    })
    
	// GET /user/
    router.Get("/user/*", func(c *pulse.Context) error {
        c.String("Hello, World!")
        return nil
    })
    
    app.Router = router
    
    app.Run(":3000")
}

Supports GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD, CONNECT, TRACE

package main

import (
	"github.com/gopulse/pulse"
)

func main() {
	app := pulse.New()
	router := pulse.NewRouter()
	api := &pulse.Group{
		prefix: "/api",
		router: router,
	}

	v1 := api.Group("/v1")
	v1.GET("/users", func(ctx *Context) error {
		ctx.String("users")
		return nil
	})

	app.Router = router

	app.Run(":3000")
}
package main

import (
	"github.com/gopulse/pulse"
	"time"
)

func main() {
	app := pulse.New()
	router := pulse.NewRouter()

	// Static files (./static) with cache duration 24 hours
	router.Static("/", "./static", &pulse.Static{
		Compress:      true,
		ByteRange:     false,
		IndexName:     "index.html",
		CacheDuration: 24 * time.Hour,
	})

	app.Router = router

	app.Run(":3000")
}
package main

import (
	"github.com/gopulse/pulse"
)

func main() {
	app := pulse.New()
	router := pulse.NewRouter()

	router.Get("/profile/:name", func(ctx *pulse.Context) error {
		if ctx.Param("name") != "test" {
			ctx.Abort()
			ctx.Status(404)
			return nil
		}
		ctx.String("hello")
		ctx.Next()
		return nil
	})

	app.Router = router

	app.Run(":3000")
}

Available Middleware

package main

import (
	"github.com/gopulse/pulse"
)

func main() {
	app := pulse.New()
	router := pulse.NewRouter()

	router.Get("/", func(ctx *pulse.Context) error {
		return nil
	})

	router.Use("GET", pulse.CORSMiddleware())

	app.Router = router

	app.Run(":3000")
}

License

Pulse is licensed under the MIT License. See LICENSE for the full license text.

Contributing

Contributions are welcome! Please read the contribution guidelines first.

Support

If you want to say thank you and/or support the active development of Pulse:

  1. Add a GitHub Star to the project.
  2. Tweet about the project on your Twitter
  3. Write a review or tutorial on Medium, dev.to, Reddit or personal blog.
  4. Buy Me a Coffee

Contributors

<!-- CONTRIBUTORS-START --> <a href="https://github.com/gopulse/pulse/graphs/contributors"> <img src="https://contrib.rocks/image?repo=gopulse/pulse&columns=18" /> </a> <!-- CONTRIBUTORS-END -->

Stargarazers over time

Stargazers over time