Zenler Player
Your course is loading. Hang tight.
Building Web Applications with Go - Intermediate Level
Back to curriculum
0% Complete
0% Complete
Introduction
Mistakes. We all make them.
How to ask for help
Installing Go
Installing an IDE
Get a free Stripe account
Installing make
Installing MariaDB
Getting a database client
What we're going to build
Setting up a (trivial) web application
Setting up routes and building a render function
Displaying one page
A better extension for Go templates and VS Code
Creating the form
Connecting our form to stripe.js
Client side validation
Getting the paymentIntent - setting up the back end package
Getting the paymentIntent - starting work on the back end api
Getting the paymentIntent - setting up a route and handler, and using make
Getting the paymentIntent - finishing up our handler
Updating the front end JavaScript to call our paymentIntent handler
Getting the payment intent, and completing the transction
Generating a receipt
Cleaning up the API url and Stripe Publishable Key on our form
What are we going to build?
Create the database
Connecting to the database
Creating a product page
Creating the product form
Moving JavaScript to a reusable file
Modifying a handler to take a struct
Update the Widget page to use data passed to the template
Creating a formatCurrency template function
Testing the transaction functionality
Creating a database table for items for sale
Running database migrations
Creating database models
Working on database functions
Inserting a new transaction
Inserting a new order
An aside: fixing a problem with calculating the amount
Getting more information about a transaction
Customers
Getting started saving customer and transaction information
Create the save customer database method
Saving the customer, transaction, and order from the handler
Running a test transaction
Fixing a database error, and saving more details
Redirecting after post
Simplifying our PaymentSucceeded handler
Revising our Virtual Terminal
Fixing a mistake in the formatCurrency template function
What are we going to build in this section?
Creating a Plan on the Stripe Dashboard
Creating stubs for the front end page and handler
Setting up the form
Working on the JavaScript for plans
Continuing with the Javascript for subscribing to a plan
Create a handler for the POST request after a user is subscribed
Create methods to create a Stripe customer and subscribe to a plan
Updating our handler to complete a subscription
Saving transaction & customer information to the database
Saving transaction & customer information II
Displaying a receipt page for the Bronze Plan
Introduction
Creating a login page
Writing the stub javascript to authenticate against the back end
Create a route and handler for authentication
Create a writeJSON helper function
Starting the authentication process
Creating an invalidCredentials helper function
Creating a passwordMatches helper function
Making sure that everything works
Create a function to generate a token
Generating and sending back a token
Saving the token to the database
Saving the token to local storage
Changing the login link based on authentication status
Checking authentication on the back end
A bit of housekeeping
Creating stub functions to validate a token
Extracting the token from the authorization header
Validating the token on the back end
Testing out our token validation
Challenge: Checking for expiry
Solution to challenge
Implementing middleware to protect specfic routes
Trying out a protected route
Converting the Virtual Terminal post to use the back end
Changing the virtual terminal page to use fetch
Verifying the saved transaction
Writing middleware on the front end to check authentication
Protecting routes on the front end
Logging out from the front end
Saving sessions in the database
Password resets
Sending mail Part I
Mailtrap.io
Sending mail Part II
Creating our mail templates and sending a test email
Implementing signed links for our email message
Using our urlsigner package
Creating the reset password route and handler
Setting up the reset password page
Creating a back end route to handle password resets
Setting an expiry for password reset emails
Adding an encryption package
Using our encryption package to lock down password resets
Improving our front end and setting up an Admin menu
Setting up stub pages for sales and subscriptions
Updating migrations and resetting the database
Listing all sales: database query
Listing all sales: database function
Listing all sales: writing the API handler and route
Listing all sales: front end javascript
Displaying our results in a table
Making our table prettier, and adding some checks in JavaScript
Challenge
Solution to challenge
Displaying a sale: part 1
Displaying a sale: part 2
Displaying a subscription
Refunds from the Stripe Dashboard
Adding a refund function to our cards package
Creating an API handler to process refunds
Update the front end for refunds
Improving the front end
Adding UI components to the sales page
Updating status to refunded in the database
Capturing the subscription id
Adding a CancelSubscription function to our cards package
Creating a handler to cancel a subscription
Modifying the front end
Finishing up the front end
Creating a database method to paginate all orders
Modifying the AllSales handler to use paginated data
Updating the all-sales.page.gohtml template
Improving pagination on the front end
Adding listeners to page navigation buttons
Taking user to correct page of data on click
How I implemented pagination on the all subscriptions page
Setting up templates to manage users
Adding routes and handlers on the front end
Writing the database functions to manage user
Creating a handler and route for all users on the back end
Updating the front end to call AllUsers
Displaying the list of users
Creating a user add or edit form
Call the api back end to get one user
Populating the user form, and a challenge
Solution to challenge
Saving an edited user - part one
Saving an edited user - part two
Deleting a user
Removing the deleted users token from the database
Setting up websockets
Connecting to WebSockets from the browser
Logging the deleted user out over websockets
What are microservices?
Setting up a simple microservice
Receiving data with our microservice
Generating an invoice as a PDF
Testing our PDF
Mailing the invoice
Call the microservice when a Widget is sold
Challenge
Solution
Setting up a validation package
Adding validation on the API back end
Modifying the front end javascript
gRPC, SOA, and more
Introduction
Introduction
Preview
Mistakes. We all make them.
How to ask for help
Setting Up Our Environment
Installing Go
Installing an IDE
Get a free Stripe account
Installing make
Installing MariaDB
Getting a database client
Building a virtual credit card terminal
What we're going to build
Preview
Setting up a (trivial) web application
Preview
Setting up routes and building a render function
Displaying one page
A better extension for Go templates and VS Code
Creating the form
Connecting our form to stripe.js
Client side validation
Getting the paymentIntent - setting up the back end package
Getting the paymentIntent - starting work on the back end api
Getting the paymentIntent - setting up a route and handler, and using make
Getting the paymentIntent - finishing up our handler
Updating the front end JavaScript to call our paymentIntent handler
Getting the payment intent, and completing the transction
Preview
Generating a receipt
Cleaning up the API url and Stripe Publishable Key on our form
Selling a product online
What are we going to build?
Create the database
Connecting to the database
Creating a product page
Creating the product form
Moving JavaScript to a reusable file
Modifying a handler to take a struct
Update the Widget page to use data passed to the template
Creating a formatCurrency template function
Testing the transaction functionality
Creating a database table for items for sale
Running database migrations
Creating database models
Working on database functions
Inserting a new transaction
Inserting a new order
An aside: fixing a problem with calculating the amount
Getting more information about a transaction
Customers
Getting started saving customer and transaction information
Create the save customer database method
Saving the customer, transaction, and order from the handler
Running a test transaction
Fixing a database error, and saving more details
Redirecting after post
Simplifying our PaymentSucceeded handler
Revising our Virtual Terminal
Fixing a mistake in the formatCurrency template function
Setting up and charging a recurring payment using Stripe Plans
What are we going to build in this section?
Creating a Plan on the Stripe Dashboard
Creating stubs for the front end page and handler
Setting up the form
Working on the JavaScript for plans
Continuing with the Javascript for subscribing to a plan
Create a handler for the POST request after a user is subscribed
Create methods to create a Stripe customer and subscribe to a plan
Updating our handler to complete a subscription
Saving transaction & customer information to the database
Saving transaction & customer information II
Displaying a receipt page for the Bronze Plan
Authentication
Introduction
Creating a login page
Writing the stub javascript to authenticate against the back end
Create a route and handler for authentication
Create a writeJSON helper function
Starting the authentication process
Preview
Creating an invalidCredentials helper function
Creating a passwordMatches helper function
Making sure that everything works
Create a function to generate a token
Generating and sending back a token
Saving the token to the database
Saving the token to local storage
Changing the login link based on authentication status
Checking authentication on the back end
A bit of housekeeping
Creating stub functions to validate a token
Extracting the token from the authorization header
Validating the token on the back end
Testing out our token validation
Challenge: Checking for expiry
Solution to challenge
Implementing middleware to protect specfic routes
Trying out a protected route
Converting the Virtual Terminal post to use the back end
Changing the virtual terminal page to use fetch
Verifying the saved transaction
Protecting routes on the Front End and improving authentication
Writing middleware on the front end to check authentication
Protecting routes on the front end
Logging out from the front end
Saving sessions in the database
Mail and Password Resets
Password resets
Sending mail Part I
Mailtrap.io
Sending mail Part II
Creating our mail templates and sending a test email
Implementing signed links for our email message
Using our urlsigner package
Creating the reset password route and handler
Setting up the reset password page
Creating a back end route to handle password resets
Setting an expiry for password reset emails
Adding an encryption package
Using our encryption package to lock down password resets
Building Admin pages to manage purchases
Improving our front end and setting up an Admin menu
Setting up stub pages for sales and subscriptions
Updating migrations and resetting the database
Listing all sales: database query
Listing all sales: database function
Preview
Listing all sales: writing the API handler and route
Listing all sales: front end javascript
Displaying our results in a table
Making our table prettier, and adding some checks in JavaScript
Challenge
Solution to challenge
Displaying a sale: part 1
Displaying a sale: part 2
Displaying a subscription
Refunds
Refunds from the Stripe Dashboard
Adding a refund function to our cards package
Creating an API handler to process refunds
Update the front end for refunds
Improving the front end
Adding UI components to the sales page
Updating status to refunded in the database
Canceling Subscriptions
Capturing the subscription id
Adding a CancelSubscription function to our cards package
Creating a handler to cancel a subscription
Modifying the front end
Finishing up the front end
Paginating Data
Creating a database method to paginate all orders
Modifying the AllSales handler to use paginated data
Updating the all-sales.page.gohtml template
Improving pagination on the front end
Adding listeners to page navigation buttons
Taking user to correct page of data on click
How I implemented pagination on the all subscriptions page
Managing Users
Setting up templates to manage users
Adding routes and handlers on the front end
Writing the database functions to manage user
Creating a handler and route for all users on the back end
Updating the front end to call AllUsers
Displaying the list of users
Creating a user add or edit form
Call the api back end to get one user
Populating the user form, and a challenge
Solution to challenge
Saving an edited user - part one
Saving an edited user - part two
Deleting a user
Removing the deleted users token from the database
Setting up websockets
Connecting to WebSockets from the browser
Logging the deleted user out over websockets
Microservices
What are microservices?
Setting up a simple microservice
Receiving data with our microservice
Generating an invoice as a PDF
Testing our PDF
Mailing the invoice
Call the microservice when a Widget is sold
Challenge
Solution
Validation
Setting up a validation package
Adding validation on the API back end
Modifying the front end javascript
Where to go next
gRPC, SOA, and more
×
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