File: server.go

package info (click to toggle)
golang-github-rs-cors 1.7.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, experimental, forky, sid, trixie
  • size: 184 kB
  • sloc: makefile: 3
file content (21 lines) | stat: -rw-r--r-- 308 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package main

import (
	"net/http"

	"github.com/pressly/chi"
	"github.com/rs/cors"
)

func main() {
	r := chi.NewRouter()

	// Use default options
	r.Use(cors.Default().Handler)

	r.Get("/", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("welcome"))
	})

	http.ListenAndServe(":8080", r)
}