Zenler Player
Your course is loading. Hang tight.
Building Modern Web Applications with Go (Golang)
Back to curriculum
0% Complete
0% Complete
Introduction: who I am, and what we're going to do
Why Go? Why not PHP, or Python, or Node.js, or
Why use Go? - System
Installing Go, an IDE, and writing a simple program
Getting help: How to ask questions
Some Useful Resources
A note about the terminal on Windows: Git Bash
Variables & Functions
Pointers
Types and Structs
Receivers: Structs with functions
Other data structures: Maps and Slices
Decision Structures
Loops and ranging over data
Interfaces
Test quiz
Packages
Channels
Reading and Writing JSON
Writing Tests in Go
How web applications work: the request/response lifecycle
Hello World for the Web
Making our application module-ready
Functions and handlers
Error checking
Serving HTML Templates
A note for Windows Users
Reorganizing our code, and adding some basic styling to pages
Enabling Go Modules and refactoring our code to use packages
Working with layouts
Building a simple template cache
Building a more complex template cache
A note about the next lectures
Setting application wide configuration
Why the application wide config is so useful
Optimizing our template cache by using an application config
A note about the next lecture
Sharing data with templates
Using pat for routing
Using chi for routing
Developing our own middleware
Installing and setting up a sessions package
Experimenting with sessions
What are we going to build?
Setting up our project
Enabling static files
Creating pages as HTML
Creating a landing page
Creating a page for each room
Adding a form to search for availability
Improving our form
Creating the reservation page
What is Javascript, and why should I care?
Making a better date picker
Custom alerts using Notie
Creating modals with SweetAlert
Implementing a Javascript module
Adding custom alerts in our Javascript module
Using our Javascript module on the "Book Now" button
What is CSS, and how does it work?
Converting our pages to Go templates
Creating handlers for our forms & adding CSRF Protection
Creating a handler that return JSON
Sending & processing an AJAX request
Sending AJAX post and generalizing our custom function
Refactoring to use internal packages
Server-side form validation
Server side form validation II
Server side form validation III
Server side form validation IV
Displaying a response to user after posting form data
Finishing up our response to user, and adding alerts
An aside: Alternate Templating Engines
Writing tests for our main package
Writing tests for our GET handlers
Writing tests for our POST handlers
Writing tests for our Render package I
Writing tests for our Render package II
Getting test coverage
Exercise: Writing tests for the Forms package
Solution to writing tests for the Forms package
Making running our application easier
Centralizing our error handling to a helpers package
Using our ClientError and ServerError helper functions
Updating our tests
Installing PostgreSQL
Connecting to the database with DBeaver on a Mac
Connecting to the database with DBeaver on Windows
Basic SQL syntax
More complex queries
Identifying database structure, and Entity Relationship Diagarams
Install Soda
Creating the users table using migrations
Creating the rest of our database using migrations
Setting up a foreign key
Setting up the rest of our foreign keys
Adding Indices & Exercise
Solution to Exercise
How to connect a Go application to a database
Creating a Driver package
Connecting to the database and adding the SQL connection to our Repository
Setting up models
Cleaning up our code
A word about ORMs
Setting up database functions: inserting a reservation
Testing our insert reservation function
Inserting Room Restrictions
Searching for availability by room
Searching for availability for all rooms
Connecting our handlers to our new database functions
Connecting search availability to the make reservation page
Cleaning up our make reservation page and testing everything
Cleaning up the reservation summary page and improving validation
Searching for availability by Room
Providing feedback when searching by room, and connecting to the reservation page
Connecting the rooms page to the make reservation page
Connecting the Major's Suite page, and extracting our javascript module
Adding a migration for seeding rooms
Adding a migration for seeding restrictions
Creating a test database repository
Updating our existing tests to handle sessions
Improving our tests by handling multiple cases
Testing Post handlers
Testing AvailabilityJSON
Completed Handler tests
Simplifying adding post parameters
Sending email using the Standard Library
Installing a mailer package and setting up a mail channel
Installing Mailhog on a Mac for testing purposes
Installing Mailhog on Windows for testing purposes
Creating and sending mail notifications
Solution to sending notification to property owner
Sending nicely formatted email using Foundation
Updating our tests
Create the login screen
Creating the authentication handlers for the login screen
Creating the authentication and user database functions
Creating our handler to log in
Writing Authentication Middleware
Adding a user to the database
Testing Login
Checking to see if a user is logged in, and logging a user out
Protecting our routes with authentication middleware
Picking an admin template
Convert the admin template into a Go template
Important: A note on the admin.layout.tmpl file
Solution to creating admin templates
Create stub handlers for admin functionality
Listing all reservations
Listing new reservations
Showing one reservation
Database functions for editing a reservation
Editing a reservation
Marking a reservation as processed
Deleting a reservation
Showing the reservation calendar
Reservation Calendar II
Reservation Calendar III
Reservation Calendar IV
Handling Calendar changes I
Handling Calendar changes II
Handling Calendar changes III
Handling Calendar changes IV
Fixing our redirects
Updating our tests
Fixing a bug missed by our tests
A word about the updated tests
Changing our app to use command line flags
An alternative: the .env file
Using vi to edit files on remote server
Choosing a server platform
Add admin user to migrations
Installing Go on the server, and getting our code up there
Setting up the remote database and building the application on our server
A note about Caddy 2.5.0
Connecting the application to the web server
Setting up Supervisor
Writing an update script for the server
A note about sending mail from the live server
Updating to Bootstrap 5
Updating the footer and page title
Finishing touches, and fixing a bug
Populating the rest of the pages
Additional resources
Introduction
Introduction: who I am, and what we're going to do
Preview
Why Go? Why not PHP, or Python, or Node.js, or
Why use Go? - System
Preview
Installing Go, an IDE, and writing a simple program
Preview
Getting help: How to ask questions
Some Useful Resources
Overview of the Go Language
A note about the terminal on Windows: Git Bash
Variables & Functions
Pointers
Types and Structs
Receivers: Structs with functions
Other data structures: Maps and Slices
Decision Structures
Loops and ranging over data
Preview
Interfaces
Preview
Test quiz
Packages
Channels
Reading and Writing JSON
Writing Tests in Go
Building a Basic Web Application
How web applications work: the request/response lifecycle
Hello World for the Web
Making our application module-ready
Functions and handlers
Error checking
Serving HTML Templates
A note for Windows Users
Reorganizing our code, and adding some basic styling to pages
Enabling Go Modules and refactoring our code to use packages
Working with layouts
Building a simple template cache
Building a more complex template cache
A note about the next lectures
Setting application wide configuration
Why the application wide config is so useful
Optimizing our template cache by using an application config
A note about the next lecture
Sharing data with templates
Improved Routing & Middleware
Using pat for routing
Using chi for routing
Developing our own middleware
State Management with Sessions
Installing and setting up a sessions package
Experimenting with sessions
Choosing a Project, and Working With Forms
What are we going to build?
Setting up our project
Enabling static files
Creating pages as HTML
Creating a landing page
Creating a page for each room
Adding a form to search for availability
Improving our form
Creating the reservation page
Javascript & CSS
What is Javascript, and why should I care?
Making a better date picker
Custom alerts using Notie
Creating modals with SweetAlert
Implementing a Javascript module
Adding custom alerts in our Javascript module
Preview
Using our Javascript module on the "Book Now" button
What is CSS, and how does it work?
Converting our HTML to Go Templates, and creating handlers
Converting our pages to Go templates
Creating handlers for our forms & adding CSRF Protection
Creating a handler that return JSON
Sending & processing an AJAX request
Sending AJAX post and generalizing our custom function
Refactoring to use internal packages
Server-side form validation
Server side form validation II
Server side form validation III
Server side form validation IV
Displaying a response to user after posting form data
Finishing up our response to user, and adding alerts
An aside: Alternate Templating Engines
Writing Tests
Writing tests for our main package
Writing tests for our GET handlers
Writing tests for our POST handlers
Writing tests for our Render package I
Writing tests for our Render package II
Getting test coverage
Exercise: Writing tests for the Forms package
Solution to writing tests for the Forms package
Making running our application easier
Improved Error Handling
Centralizing our error handling to a helpers package
Using our ClientError and ServerError helper functions
Updating our tests
Persisting Data with PostgreSQL
Installing PostgreSQL
Connecting to the database with DBeaver on a Mac
Connecting to the database with DBeaver on Windows
Basic SQL syntax
More complex queries
Designing the Database Structure
Identifying database structure, and Entity Relationship Diagarams
Install Soda
Creating the users table using migrations
Creating the rest of our database using migrations
Setting up a foreign key
Setting up the rest of our foreign keys
Adding Indices & Exercise
Solution to Exercise
Connecting our Application to the Database
How to connect a Go application to a database
Creating a Driver package
Connecting to the database and adding the SQL connection to our Repository
Setting up models
Cleaning up our code
A word about ORMs
Setting up database functions: inserting a reservation
Testing our insert reservation function
Inserting Room Restrictions
Searching for availability by room
Searching for availability for all rooms
Connecting our handlers to our new database functions
Connecting search availability to the make reservation page
Cleaning up our make reservation page and testing everything
Cleaning up the reservation summary page and improving validation
Searching for availability by Room
Providing feedback when searching by room, and connecting to the reservation page
Connecting the rooms page to the make reservation page
Connecting the Major's Suite page, and extracting our javascript module
Adding a migration for seeding rooms
Adding a migration for seeding restrictions
Updating our tests
Creating a test database repository
Updating our existing tests to handle sessions
Improving our tests by handling multiple cases
Testing Post handlers
Testing AvailabilityJSON
Completed Handler tests
Simplifying adding post parameters
Sending Mail Using Go
Sending email using the Standard Library
Installing a mailer package and setting up a mail channel
Installing Mailhog on a Mac for testing purposes
Installing Mailhog on Windows for testing purposes
Creating and sending mail notifications
Solution to sending notification to property owner
Sending nicely formatted email using Foundation
Updating our tests
Authentication
Create the login screen
Creating the authentication handlers for the login screen
Creating the authentication and user database functions
Creating our handler to log in
Writing Authentication Middleware
Adding a user to the database
Testing Login
Checking to see if a user is logged in, and logging a user out
Protecting our routes with authentication middleware
Setting up secure backend administration
Picking an admin template
Convert the admin template into a Go template
Important: A note on the admin.layout.tmpl file
Solution to creating admin templates
Create stub handlers for admin functionality
Listing all reservations
Listing new reservations
Showing one reservation
Database functions for editing a reservation
Editing a reservation
Marking a reservation as processed
Deleting a reservation
Showing the reservation calendar
Reservation Calendar II
Reservation Calendar III
Reservation Calendar IV
Handling Calendar changes I
Handling Calendar changes II
Handling Calendar changes III
Handling Calendar changes IV
Fixing our redirects
Updating our tests
Fixing a bug missed by our tests
A word about the updated tests
Updating our application to accept command line parameters
Changing our app to use command line flags
An alternative: the .env file
Deploying Our Application to a Server
Using vi to edit files on remote server
Choosing a server platform
Add admin user to migrations
Installing Go on the server, and getting our code up there
Setting up the remote database and building the application on our server
A note about Caddy 2.5.0
Connecting the application to the web server
Setting up Supervisor
Writing an update script for the server
A note about sending mail from the live server
Finishing Touches
Updating to Bootstrap 5
Updating the footer and page title
Finishing touches, and fixing a bug
Populating the rest of the pages
Where to go next
Additional resources
×
This is an unpublished lesson. This lesson will not be shown for students unless you set it as Public.
Back to Dashboard
No contents are available in this lesson!
No lessons available !
Back to Dashboard
Lesson contents locked
Enroll to unlock this lesson.
Enroll to unlock
Next Lesson