MemoryStore.NewMemoryStore
Overview
NewMemoryStore creates a memory session store.
Part of the http package — Node.js analog: express, cors, helmet, morgan.
Method on MemoryStore — call it on a value of that type after constructing or receiving one from a constructor.
Signature
go
func NewMemoryStore() *MemoryStoreCompare: Node.js · Standard Go · gox
js
// Typical express, cors, helmet, morgan pattern in Node.jsgo
func handler(w http.ResponseWriter, r *http.Request) {
// chi or net/http
}go
import "github.com/sahilkhaire/gox/http"
store := http.NewMemoryStore()Example
go
import "github.com/sahilkhaire/gox/http"
store := http.NewMemoryStore()Tips
Stack Logger, Recover, and Security middleware the way you would morgan + helmet in Express.
Standard library alternative
Use the standard library directly:
go
func handler(w http.ResponseWriter, r *http.Request) {
// chi or net/http
}