Golang REST API With Mux

In this video we will look at building a simple REST API using the Go programming language along with the Mux router. I will also explain some of the fundamentals of the language for beginners.

SPONSOR: GDP HOST – WANT CHEAP WEB HOSTING?
https://goo.gl/iZjcGk

CODE: Github Repo
https://github.com/bradtraversy/go_restapi

BECOME A PATRON: Show support & get perks!
http://www.patreon.com/traversymedia

ONE TIME DONATIONS:
http://www.paypal.me/traversymedia

VISIT MY WEBISTE: Check Out My Udemy Courses
http://www.traversymedia.com

FOLLOW TRAVERSY MEDIA:
http://www.facebook.com/traversymedia
http://www.twitter.com/traversymedia
http://www.instagram.com/traversymedia
https://discord.gg/traversymedia

Comments

Fransisco Wijaya says:

RUST RUST RUST!

Trouty McSquire says:

This was excellent Brad. The syntax for Goland is very appealing and I look forward to more tutorials.

Truth Detective says:

I know this question is off the topic, but I really wanna know if I should learn jQuery anymore. If it’s about DOM, I have no problem with vanilla javascript and animations can be easily done with CSS animations. Is there anything else that I need jQuery for? I’d love to hear the answer, specifically from Brad.

Shahid says:

Have u tried cmder its really cool command line tool for windows

Emmanuel Mutale says:

I have been waiting for this, Thanks traversy. Can’t wait for the course.Go is my favorite language,just started learning it

Benbird Z says:

Finally! Thanks so much for doing this, pls do a course on this!

Roushan jha says:

please upload new tutorials for golang

nsl3109 says:

Hey Brad, great job on all of these tutorials!
[preface: I am pretty new to web dev]
Quick question on something not related to this video – I’ve built a web app (Materialize framework) structured like the one in your NodeJS + MongoDB Article Database series from a while back and I was wondering – what would be the best way to convert it to mobile? (I just want to be able to use it on my phone, doesn’t have to be big on app store, etc)
There are a few options that I’ve thought of/just read about:
1) Getting a domain for the web app and just manually search it up in browser on phone
2) Using Apache Cordova to convert web to mobile app (I don’t know how legit this would be)
3) Redesigning the whole app using Ionic and Angular in one of your previous tutorials
4) Redesigning the whole app using React Native instead (I don’t know how difficult or practical this would be)
5) Redesigning whole app using Meteorjs (is this even legit?)
Again, I haven’t explored these options in depth yet and I don’t know the frameworks very well but I would appreciate any suggestions that you have.

james bake says:

Are the parenthesis supposed to be purple? Mine aren’t and it’s the only I can’t think of a good reason why mine isn’t working

Jason Bishop says:

Create course!…..Thank you. Awesome!

August Nejudne says:

Hi Brad! I’ve already bought a few of your courses on Udemy and I learned a ton from them. But I’m wondering if you could make a course making a social media app, like a facebook clone, using angular and firestore.

Daniel Sokil says:

I was shocked to see this video. THANKS! You are awesome. So is golang

Alvaro Chévez says:

Excellent video Brad! Thank you very much!

saeful rahman says:

hello, why my go run run very slow on my windows pc, yours is much faster to compile, i’m using i7 pc

mirekum says:

Great tutorial, we’re waiting for the second part

Medoune Kane says:

Thanks again Brad!!! God Bless you!!!

Muhammad Arifin says:

this is the best go tutorial for bignner ever I seen….

Андрей Артеха says:

I think a lot of us would by a course about go from you. Hit the like if you’re would too.

Leandrit Ferizi says:

When will the course come up? Golang lacks courses in Youtube, Udemy and so on. It will be big I am sure.

freddiλN says:

Why did you decide to capitalize the structs in this project? I mean they worked just fine for me in lowercase and (afaik) having them start with an uppercase letter would only export them (which wouldn’t be needed in this small project).

LocKerz Edward says:

The ugliest language ever.
But your channel is great!

Jon Brookes says:

Thanks again Brad. Another really good tutorial. Go is by far my favourite language just now and for the purpose of serving json apis in this manner is highly performant. You’ve shown how to get this done efficiently and explain how to get there in a very clear and easy to understand way.

Eduardo mendoza says:

Nice course mate, you should create a Ruby on Rails course on Udemy, will buy for sure!!

Tharindu Lakshitha says:

Loved it! And waiting for the 2nd part with database <3

Abdallah AlSahhar says:

what golang framework you suggest to learn, like what is the most popular ?

Paul Bird says:

For the update function didn’t need to do anything with the ID as the book object included the right ID .

func updateBook(w http.ResponseWriter, r *http.Request) {
w.Header().Set(“Content-Type”, “application/json”)
params := mux.Vars(r)
var book Book
_ = json.NewDecoder(r.Body).Decode(&book)
for index, item := range books {
if item.ID == params[“id”] {
books = append(books[:index], books[index+1:]…)
books = append(books, book)
break
}
}
json.NewEncoder(w).Encode(book)
}

张洪铭 says:

Great! Love your style~

toan le says:

Hello Traversy, do you have a golang + vuejs/reactjs course on udemy ?

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours