Course Overview
This course is the followup to Building Modern Web Applications in Go. In this course, we go further than we did the first time around. We will build a sample E-Commerce application that consists of multiple, separate applications: a front end (which services content to the end user as web pages); a back end API (which is called by the front end as necessary), and a microservice that performs only one task, but performs it extremely well (dynamically building PDF invoices and sending them to customers as an email attachment).
The application will sell individual items, as well as allow users to purchase a monthly subscription. All credit card transactions will be processed through Stripe, which is arguably one of the most popular payment processing systems available today, and for good reason: developers love it. Stripe offers a rich API (application programming interface), and it is available in more than 35 countries around the world, and works with more than 135 currencies. Literally millions of organizations and businesses use Stripe’s software and APIs to accept payments, send payouts, and manage their businesses online with the Stripe dashboard. However, in many cases, developers want to be able to build a more customized solution, and not require end users to log in to both a web application and the Stripe dashboard. That is precisely the kind of thing that we will be covering in this course.
We will start with a simple Virtual Terminal, which can be used to process so-called "card not present" transactions. This will be a fully functional web application, built from the ground up on Go (sometimes referred to as Golang). The front end will be rendered using Go's rich html/template package, and authenticated users will be able to process credit card payments from a secure form, integrated with the Stripe API. In this section of the course, we will cover the following:
How to build a secure, production ready web application in Go
How to capture the necessary information for a secure online credit card transaction
How to call the Stripe API from a Go back end to create a paymentIntent (Stripe's object for authorizing and making a transaction)
Once we have that out of the way, we'll build a second web application in the next section of the course, consisting of a simple web site that allows users to purchase a product, or purchase a monthly subscription. Again, this will be a web application built from the ground up in Go. In this section of the course, we'll cover the following:
How to allow users to purchase a single product
How to allow users to purchase a recurring monthly subscription (a Stripe Plan)
How to handle cancellations and refunds
How to save all transaction information to a database (for refunds, reporting, etc).
How to refund a transaction
How to cancel a subscription
How to secure access to the front end (via session authentication)
How to secure access to the back end API (using stateful tokens)
How to manage users (add/edit/delete)
How to allow users to reset their passwords safely and securely
How to log a user out and cancel their account instantly, over websockets
Once this is complete, we'll start work on the microservice. A microservice is a particular approach to software development that has the basic premise of building very small applications that do one thing, but do it very well. A microservice does not care in the slightest about what application calls it; it is completely separate, and completely agnostic. We'll build a microserivce that does the following:
Accepts a JSON payload describing an individual purchase
Produces a PDF invoice with information from the JSON payload
Creates an email to the customer, and attaches the PDF to it
Sends the email
All of these components (front end, back end, and microservice) will be built using a single code base that produces multiple binaries, using Gnu Make.
FAQ
FAQ area empty
Course curriculum
-
What we're going to build
136 Xem trước -
Setting up a (trivial) web application
896 Xem trước -
Setting up routes and building a render function
1239 Xem trước -
Displaying one page
536 Xem trước -
A better extension for Go templates and VS Code
190 Xem trước -
Creating the form
692 Xem trước -
Connecting our form to stripe.js
643 Xem trước -
Client side validation
468 Xem trước -
Getting the paymentIntent - setting up the back end package
945 Xem trước -
Getting the paymentIntent - starting work on the back end api
572 Xem trước -
Getting the paymentIntent - setting up a route and handler, and using make
650 Xem trước -
Getting the paymentIntent - finishing up our handler
527 Xem trước -
Updating the front end JavaScript to call our paymentIntent handler
541 Xem trước -
Getting the payment intent, and completing the transaction
1054 Xem trước -
Generating a receipt
710 Xem trước -
Cleaning up the API url and Stripe Publishable Key on our form
247 Xem trước -
Test your knowledge
-
What are we going to build?
95 Xem trước -
Create the database
93 Xem trước -
Connecting to the database
498 Xem trước -
Creating a product page
356 Xem trước -
Creating the product form
259 Xem trước -
Moving JavaScript to a reusable file
268 Xem trước -
Modifying the handler to take a struct
564 Xem trước -
Update the Widget page to use data passed to the template
295 Xem trước -
Creating a formatCurrency template function
206 Xem trước -
Testing the transaction functionality
252 Xem trước -
Creating a database table for items for sale
642 Xem trước -
Running database migrations
175 Xem trước -
Creating database models
620 Xem trước -
Working on database functions
351 Xem trước -
Inserting a new transaction
238 Xem trước -
Inserting a new order
140 Xem trước -
An aside: fixing a problem with calculating the amount
320 Xem trước -
Getting more information about a transaction
827 Xem trước -
Customers
619 Xem trước -
Getting started saving customer and transaction information
609 Xem trước -
Create the save customer database method
138 Xem trước -
Saving the customer, transaction, and order from the handler
987 Xem trước -
Running a test transaction
394 Xem trước -
Fixing a database error, and saving more details
501 Xem trước -
Redirecting after post
395 Xem trước -
Simplifying our PaymentSucceeded handler
958 Xem trước -
Revising our Virtual Terminal
577 Xem trước -
Fixing a mistake in the formatCurrency template function
99 Xem trước
-
What are we going to build in this section?
121 Xem trước -
Creating a Plan on the Stripe Dashboard
185 Xem trước -
Creating stubs for the front end page and handler
279 Xem trước -
Setting up the form
559 Xem trước -
Working on the JavaScript for plans
423 Xem trước -
Continuing with the Javascript for subscribing to a plan
289 Xem trước -
Create a handler for the POST request after a user is subscribed
388 Xem trước -
Create methods to create a Stripe customer and subscribe to a plan
531 Xem trước -
Updating our handler to complete a subscription
371 Xem trước -
Saving transaction & customer information to the database
599 Xem trước -
Saving transaction & customer information II
869 Xem trước -
Displaying a receipt page for the Bronze Plan
436 Xem trước
-
Introduction
225 Xem trước -
Creating a login page
423 Xem trước -
Writing the stub javascript to authenticate against the back end
204 Xem trước -
Create a route and handler for authentication
817 Xem trước -
Create a writeJSON helper function
253 Xem trước -
Starting the authentication process
356 Xem trước -
Creating an invalidCredentials helper function
187 Xem trước -
Creating a passwordMatches helper function
379 Xem trước -
Making sure that everything works
105 Xem trước -
Create a function to generate a token
445 Xem trước -
Generating and sending back a token
235 Xem trước -
Saving the token to the database
451 Xem trước -
Saving the token to local storage
484 Xem trước -
Changing the login link based on authentication status
563 Xem trước -
Checking authentication on the back end
681 Xem trước -
A bit of housekeeping
46 Xem trước -
Creating stub functions to validate a token
289 Xem trước -
Extracting the token from the authorization header
268 Xem trước -
Validating the token on the back end
376 Xem trước -
Testing out our token validation
322 Xem trước -
Challenge: Checking for expiry
76 Xem trước -
Solution to challenge
379 Xem trước -
Implementing middleware to protect specfic routes
214 Xem trước -
Trying out a protected route
146 Xem trước -
Converting the Virtual Terminal post to use the back end
616 Xem trước -
Changing the virtual terminal page to use fetch
788 Xem trước -
Verifying the saved transaction
159 Xem trước
-
Password resets
588 Xem trước -
Sending mail Part I
855 Xem trước -
Mailtrap.io
108 Xem trước -
Sending mail Part II
644 Xem trước -
Creating our mail templates and sending a test email
612 Xem trước -
Implementing signed links for our email message
764 Xem trước -
Using our urlsigner package
393 Xem trước -
Creating the reset password route and handler
379 Xem trước -
Setting up the reset password page
405 Xem trước -
Creating a back end route to handle password resets
552 Xem trước -
Setting an expiry for password reset emails
201 Xem trước -
Adding an encryption package
739 Xem trước -
Using our encryption package to lock down password resets
327 Xem trước
-
Improving our front end and setting up an Admin menu
450 Xem trước -
Setting up stub pages for sales and subscriptions
382 Xem trước -
Updating migrations and resetting the database
211 Xem trước -
Listing all sales: database query
297 Xem trước -
Listing all sales: database function
358 Xem trước -
Listing all sales: writing the API handler and route
122 Xem trước -
Listing all sales: front end javascript
386 Xem trước -
Displaying our results in a table
325 Xem trước -
Making our table prettier, and adding some checks in JavaScript
292 Xem trước -
Challenge
100 Xem trước -
Solution to challenge
128 Xem trước -
Displaying a sale: part 1
684 Xem trước -
Displaying a sale: part 2
300 Xem trước -
Displaying a subscription
284 Xem trước
-
Refunds from the Stripe Dashboard
61 Xem trước -
Adding a refund function to our cards package
202 Xem trước -
Creating an API handler to process refunds
415 Xem trước -
Update the front end for refunds
850 Xem trước -
Improving the front end
199 Xem trước -
Adding UI components to the sales page
545 Xem trước -
Updating status to refunded in the database
240 Xem trước
-
Creating a database method to paginate all orders
406 Xem trước -
Modifying the AllSales handler to use paginated data
241 Xem trước -
Updating the all-sales.page.gohtml template
337 Xem trước -
Improving pagination on the front end
572 Xem trước -
Adding listeners to page navigation buttons
259 Xem trước -
Taking user to correct page of data on click
197 Xem trước -
How I implemented pagination on the all subscriptions page
134 Xem trước
-
Setting up templates to manage users
359 Xem trước -
Adding routes and handlers on the front end
149 Xem trước -
Writing the database functions to manage users
628 Xem trước -
Creating a handler and route for all users on the back end
118 Xem trước -
Updating the front end to call AllUsers
151 Xem trước -
Displaying the list of users
242 Xem trước -
Creating a user add/edit form
423 Xem trước -
Call the api back end to get one user
352 Xem trước -
Populating the user form, and a challenge
403 Xem trước -
Solution to challenge
175 Xem trước -
Saving an edited user - part one
344 Xem trước -
Saving an edited user - part two
522 Xem trước -
Deleting a user
462 Xem trước -
Removing the deleted users token from the database
208 Xem trước -
Setting up websockets
1129 Xem trước -
Connecting to WebSockets from the browser
384 Xem trước -
Logging the deleted user out over websockets
359 Xem trước
-
What are microservices?
96 Xem trước -
Setting up a simple microservice
847 Xem trước -
Receiving data with our micrsoservice
403 Xem trước -
Generating an invoice as a PDF
1221 Xem trước -
Testing our PDF
329 Xem trước -
Mailing the invoice
494 Xem trước -
Call the microservice when a Widget is sold
580 Xem trước -
Challenge
94 Xem trước -
Solution
155 Xem trước
Requirment
-
A basic understanding of the Go programming language
-
A basic understanding of HTML, CSS, and JavaScript
-
A basic understanding of SQL syntax
Outcomes
-
How to build a front end website using Go
-
How to build a back end API using Go
-
How to build multiple applications from a single code base
-
How to build microservices in Go
-
User authentication in Go
-
API authentication using stateful tokens
-
How to allow users to reset a password in a safe, secure manner
-
How to integrate Stripe credit card processing with a Go back end
-
Make one time or recurring payments with Stripe
-
Best practices for making secure credit card transactions
1 Student
1 Course
0 review