Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/OnlyNico43/gin-cors

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/OnlyNico43/gin-cors

  • v1.0.4
  • Source
  • Go
  • Socket score

Version published
Created
Source

Gin Cors Middleware

The gin-cors package can be used in every Gin project and configure the cors behaviour of your application.

Getting started

After installing and setting up Go you can create yor first project with gin.

In your main go file create a basic gin http server with the gin-cors middleware package

package main

import (
  "net/http"

  "github.com/gin-gonic/gin"
  cors "github.com/OnlyNico43/gin-cors"
)

func main() {
  r := gin.Default()

  r.Use(cors.CorsMiddleware(cors.DefaultConfig()))

  r.GET("/ping", func(c *gin.Context) {
    c.String(http.StatusOK, "pong")
  })

  r.Run(":8080")
}

Done, now your application is equipped with a basic cors configuration

How to configure

You can either use the default configuration or decide to use your own values in the Config object.

For more details please see the documentation

FAQs

Package last updated on 08 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc