command
module
Version:
v0.0.0-...-2cceb0b
Opens a new window with list of versions in this module.
Published: Jun 2, 2021
License: MIT
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
First Go Api Mux
A tiny RestFul API is written in Go with Mux HTTP router.
Router
router := mux.NewRouter().StrictSlash(true)
router.HandleFunc("/", homePage).Methods("GET")
router.HandleFunc("/investories", getInvestories).Methods("GET")
router.HandleFunc("/investory/{uid}", getInvestory).Methods("GET")
router.HandleFunc("/investory", createInvestory).Methods("POST")
router.HandleFunc("/investory/{uid}", deleteInvestory).Methods("DELETE")
router.HandleFunc("/investory/{uid}", updateInvestory).Methods("PUT")
log.Fatal(http.ListenAndServe(":8000", router))
WHAT'S IS MUX?
A powerful HTTP router and URL matcher for building Go web servers with gorilla. (https://github.com/gorilla/mux)
Getting start
go get -u github.com/gorilla/mux
go mod init
go mod init github.com/basemax/FirstGoApiMux
go mod tidy
go run main.go
go build
References
Copyright 2021, Max Base
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.