Check out a free preview of the full HTMX & Go course

The "Project Setup" Lesson is part of the full, HTMX & Go course featured in this preview video. Here's what you'd learn in this lesson:

ThePrimeagen provides instructions for setting up the necessary tools and dependencies for the course. They also emphasize the importance of actively engaging with the material and encourage students to use the Chrome debugger for troubleshooting.

Preview
Close

Transcript from the "Project Setup" Lesson

[00:00:00]
>> You're gonna need to install Golang, 1.2 or higher preferably, or 1.21 or higher. You can Google install Golang, it's pretty straightforward. And you should really also install Air. Air is really easy, just copy and paste this line right here. And it will just make things work out very, very easily.

[00:00:18]
Also make sure you have the Go-LSP. Again, life is just easier if you have an LSP. I don't know how VS code does LSP. So if you're using VS code, I'm sure it will just tell you how to install it. But if you're using Vim, make sure you get Go, please.

[00:00:31]
And then I have just a little quick set of things you're gonna want to execute to just get everything up and running. If you're completely unfamiliar with Go, I'm gonna move faster than completely unfamiliar. But you can most certainly read the code very easy. And all the code will be on the Internet.

[00:00:48]
I'm not sure if I pushed it up or not. I could get it pushed up pretty quickly. It's pretty straightforward language. Go is an easily, if you have any experience coding, you can pretty much read the language off the rip. It is about as simple as a language as one can get.

[00:01:03]
And it's the reason why I chose it for this workshop. I really wanted to use Rust or OCaml, but it's just way harder to convince a group of people to follow along when you're using not the simplest C based language possible. Okay, everybody, if you can clone down this project, I give us just a little bit of a base template that has a couple things in it, including just the Air script that's just it makes life pretty easy.

[00:01:30]
All right, awesome, so everyone's there. I probably need to also do that so I'm just gonna do that, do the exact same thing, fantastic. Sometimes you're gonna, hey, hey, hey, it didn't go through. Did I not, well, whatever, go, There we go, fantastic. And we can even go mod tidy if you need to.

[00:01:51]
It's kind of nice to do, look at that. It already has some things already installed for me. I shouldn't have anything installed for me, whatever. That's fine enough, I shouldn't be installing anything things. Quick notes, we're gonna be going through this pretty quick. I've added some intentional failure cases so we can kinda debug what's happening and kinda discover how HTMX works.

[00:02:10]
There are some intentional moments where you're supposed to feel confused or you're supposed to not like what's happening. I want you actively engaged. Please take the time to guess why things are not working. Please open up the Chrome debugger, if you can keep up, it would be very, very good, and I may mess up and accidentally program the right thing.

[00:02:29]
And if that happens, I'm sorry, we can back it up and I can try to program the wrong thing to begin with. But if we do it on, if we do good, I'm sorry. That's just part of it. And of course, you will forget everything that you've learned up until now to be able to be successful with HTMX.

[00:02:45]
If you try to build an HTMX application like you'd build a React application, you'll be upset. Just like if you try to build a React application with HTMX knowledge, you will be upset. Use any tool the wrong way and it becomes a mess pretty quickly. So we will be using URLs today, I know.

[00:03:00]
They will be used, they will be important, we may even add query parameters to change behavior. We will even be using status codes. This will not be happening today, okay? This is not an option. There will be no 200s with a 400 inside of the body. This is just not a thing.

[00:03:16]
I know this will be difficult. Some of you may get a little scared, I'm sorry. We'll be even using HTTP verbs, get, post, and delete. We're not doing any updates, but they're not too hard. If you know how to do a delete, you know how to do an update.

[00:03:29]
We will use as little dependencies as possible. That's actually why I chose Go, is that I also don't have to tell you 900 things to go and install as far as libraries we'll be using Go templating, so it's already internal item. The only real dependency we'll have is just a server which we'll be using Echo, which appears to be the simplest possible server I can find, and that's it.

[00:03:53]
So I wanted this course to be about HTMX, not about other texts, it's really not even about Go. It just happens to use Go.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now