Webapps in Go

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Suraj Patil
Year: 0

Language: English
Pages: 192

Table of Contents......Page 5
Install the Go tools......Page 9
The toolchain......Page 13
Why Go?......Page 17
Variables......Page 20
Underlying data structures......Page 24
Important points......Page 25
array, slice, map......Page 27
Control statement......Page 36
Functions......Page 40
Basics of Struct......Page 50
methods......Page 57
Interface......Page 66
Concurrency......Page 77
Packages......Page 83
Internal deployment......Page 84
Web Programming Basics......Page 86
HTTP Methods......Page 87
What is a template?......Page 88
Static Files......Page 90
Basic web application......Page 92
Handling URLs......Page 93
Serving static files......Page 94
Homework......Page 95
The Design......Page 96
Homework......Page 98
Creating and configuring database......Page 99
Installing sqlite driver......Page 100
Importing driver......Page 102
Fetching Data from the Database......Page 104
Preparing Queries......Page 107
Single-Row Queries......Page 108
Statements that Modify Data......Page 110
Working with Transactions......Page 111
Avoiding Prepared Statements......Page 113
Prepared Statements in Transactions......Page 114
Parameter Placeholder Syntax......Page 115
Errors From Closing Resultsets......Page 116
Errors From QueryRow()......Page 117
Identifying Specific Database Errors......Page 118
Handling Connection Errors......Page 119
Working with NULLs......Page 120
Working with Unknown Columns......Page 122
The connection pool......Page 124
Large uint64 Values......Page 125
Invoking Stored Procedures......Page 126
Multiple Statement Support......Page 127
Database Encapsulation......Page 129
An Example......Page 132
Homework......Page 135
Working with Forms......Page 136
CSRF......Page 139
Input Validation......Page 144
Uploading files......Page 146
Templates......Page 149
Sub templating......Page 151
Homework......Page 156
Cookies......Page 158
Sessions......Page 159
Users......Page 162
Files......Page 167
Routing......Page 169
Middlewares......Page 171
Example......Page 172
Building an API......Page 174
JWT......Page 175
Making an API call......Page 177
Testing API......Page 179
Getting the token......Page 181
Example......Page 182
Advanced Usage......Page 184
Unit Testing......Page 185
Using git......Page 189
Branching......Page 190
Remote......Page 191