Skip to content

A simple framework to make building Go HTTP servers easier

License

Notifications You must be signed in to change notification settings

ImCarsen/jasmine

Repository files navigation

Jasmine 🫖

GitHub go.mod Go version Go Report Card

A simple framework to make building HTTP servers easier

What is Jasmine?

Jasmine is just a wrapper on Go's net/http library I made to stop having to rewrite the same code in every project.

Why is the project called Jasmine? I was thinking of a name, and saw my jasmine tea beside me. Yeah, no deeper thought.

Usage

go get github.com/ImCarsen/jasmine
package main

import (
    "github.com/ImCarsen/jasmine"
)

func main() {
    sig := make(chan os.Signal, 1)
    signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM,
    os.Interrupt)

    s := jasmine.Server{
        Address: ":8080",
        Routes: jasmine.Routes{
            Routes: map[string]jasmine.RouteHandler{
                "POST /test/{id}": jasmine.NotImplemented,
            },
            ProtectedRoutes: map[string]jasmine.RouteHandler{
                "POST /test/{id}": jasmine.NotImplemented,
            },
            AuthFunc: jasmine.DefaultAuthFunc,
        },
    } 

   go s.Start()

   <-sig
   s.Stop()
}

Contributing

I welcome any contributions, as I don't do any perfomance testing, and the practices used for Jasmine are unlikely to be the best (it's just how I felt like writing it in the moment). So, if you feel like improving this project at all, feel free to open an issue, or PR.

About

A simple framework to make building Go HTTP servers easier

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages