Skip to content

AndrewJBateman/golang-http-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ Golang Http API

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

📄 Table of contents

📚 General info

  • Go’s default request handler signature is func (w http.ResponseWriter, r *http.Request)

📷 Screenshots

techData screen print

📶 Technologies

💾 Setup

💻 Code Examples

  • function to get a post using the Gorilla mux, with pointer type *http.Request
func getPost(w http.ResponseWriter, r *http.Request) {
  // get the ID of the post from the route parameter
  // golang method strconv.Atoi is equivalent to ParseInt(s, 10, 0), converted to type int.
  ar idParam string = mux.Vars(r)["id"]
  id, err := strconv.Atoi(idParam)
  if err != nil {
    // there was an error
    w.WriteHeader(400)
    w.Write([]byte("ID could not be converted to integer"))
    return
  }

🆒 Features

📋 Status & To-do list

  • Status: Working
  • To-do: Nothing

👏 Inspiration

📁 License

  • This project is licensed under the terms of the MIT license.

✉️ Contact

About

📋 GoLang tutorial project to learn the basics of Go

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages