<commit_before>package main

// $ go get github.com/rs/cors
// $ go run main.go

import (
	"github.com/kataras/iris"
	"github.com/kataras/iris/core/router"

	"github.com/iris-contrib/middleware/cors"
)

func main() {

	app := iris.New()
	crs := cors.NewPartyMiddleware(cors.Options{
		AllowedOrigins:   []string{"*"}, // allows everything, use that to change the hosts.
		AllowedMethods:   router.AllMethods[:],
		AllowCredentials: true,
	})

	v1 := app.Party("/api/v1")
	v1.ConfigureParty(crs)
	{
		v1.Get("/home", func(ctx iris.Context) {
			ctx.WriteString("Hello from /home")
		})
		v1.Get("/about", func(ctx iris.Context) {
			ctx.WriteString("Hello from /about")
		})
		v1.Post("/send", func(ctx iris.Context) {
			ctx.WriteString("sent")
		})
		v1.Put("/send", func(ctx iris.Context) {
			ctx.WriteString("updated")
		})
		v1.Delete("/send", func(ctx iris.Context) {
			ctx.WriteString("deleted")
		})
	}

	// or use that to wrap the entire router
	// even before the path and method matching<commit_msg>Add comment in example<commit_after>package main

// $ go get github.com/rs/cors
// $ go run main.go

import (
	"github.com/kataras/iris"
	"github.com/kataras/iris/core/router"

	"github.com/iris-contrib/middleware/cors"
)

func main() {

	app := iris.New()

	// `crs := cors.NewAllowAllPartyMiddleware()`, or:
	crs := cors.NewPartyMiddleware(cors.Options{
		AllowedOrigins:   []string{"*"}, // allows everything, use that to change the hosts.
		AllowedMethods:   router.AllMethods[:],
		AllowCredentials: true,
	})

	v1 := app.Party("/api/v1")
	v1.ConfigureParty(crs)
	{
		v1.Get("/home", func(ctx iris.Context) {
			ctx.WriteString("Hello from /home")
		})
		v1.Get("/about", func(ctx iris.Context) {
			ctx.WriteString("Hello from /about")
		})
		v1.Post("/send", func(ctx iris.Context) {
			ctx.WriteString("sent")
		})
		v1.Put("/send", func(ctx iris.Context) {
			ctx.WriteString("updated")
		})
		v1.Delete("/send", func(ctx iris.Context) {
			ctx.WriteString("deleted")
		})
	}

	// or use that to wrap the entire router
	// even before the path and method matching
{'fraction_non_alphanumeric': 0.17418426103646834, 'fraction_numerical': 0.007677543186180422, 'mean_word_length': 3.5723684210526314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '973578', 'n_tokens_mistral': 837, 'n_tokens_neox': 783, 'n_words': 153}