Web Development with Go(pdf)


-
Go, often referred to as Golang, is a general-purpose programming language that was developed at Google in November 2009. Several programming languages are available for writing different kinds of software systems, and some languages have existed for decades. Some mainstream programming languages ar
Web Development with Go Copyright 2015 by Shiju Varghese This work is subject to copyright All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information torage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher's location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through Rightslink at the Copyright Clearance Center Violations are liable to prosecution under the respective Copyright Law ISBN-13(pbk):978-1-4842-1053-6 ISBN-13( electronic:978-1-4842-10529 Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights While the advice and information in this book are believed to be true and accurate at the date of publicatio neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein Managing director: Welmoed spahr Lead Editor: Celestin John Suresh Technical reviewer: Prateek baheti Michelle Lowman, James Markham, Susan McDermott, Matthew Moodie, Jeffrey pepper son Editorial Board: Steve Anglin, Louise Corrigan, Jim DeWolf, Jonathan Gennick, Robert Hutchir Douglas Pundick, Ben Renow-Clarke, Gwenan Spearing Coordinating Editor: Jill Balzano Copy Editor Nancy Sixsmith Compositor: SPi Global Indexer: SPi Global Artist: SPi Global Distributed to the book trade worldwide by Springer Science+ Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax(201)348-4505 e-mailorders-ny@springer-sbm.comorvisitwww.springer.comApressMedia,lLcisaCaliforniaLlc and the sole member(owner)is Springer Science+ Business Media Finance Inc(SSBM Finance Inc) SSBM Finance Inc is a Delaware corporation Forinformationontranslationspleasee-mailrights@apress.com,orvisitwww.apress.com Apress and friends ofed books may be purchased in bulk for academic, corporate or promotional use eBook versions and licenses are also available for most titles. For more information, reference our Special BulkSales-ebookLicensingwebpageatwww.apress.com/bulk-sales Any source code or other supplementary material referenced by the author in this text is available to readers atwww.apress.comFordetailedinformationabouthowtolocateyourbookssourcecodegoto www.apress.com/source-code/. www.it-ebooks.info I would like to dedicate this book to my parents, the late C.s. varghese and rosy varghese. I would like to thank them for their unconditional love and life struggles for the betterment ofour lives Without their love and support, this book would not have been possible ene rose I would like to dedicate this book to my lovely wife rosmi and beautiful daughter Finally, i would like to dedicate this book to my elder sister Shaijy and younger brother shinto -Shiju varghese www.it-ebooks.info Contents at a glance About the author About the technical reviewer ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ XVII Introduction ■■■■■■■■■■■ XIX Chapter 1: Getting started with Go ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ Chapter 2: Go Fundamentals aa ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 15 Chapter3:User- Defined Types and concurrency…,,,,,,……mm35 Chapter 4: Getting Started with Web Development mmmm mmn 59 Chapter 5: Working with Go Templates ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 79 Chapter 6: Http Middleware ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 99 Chapter 7: Authentication to Web Apps.aan 121 Chapter 8: Persistence with MongoDB mmmmmmmmmmmmmmmmmm 141 Chapter 9: Building restful Services ma. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 159 Chapter 10: Testing Go Applications ammar 211 Chapter 11: Building Go Web applications on Google Cloud mmmmmammammmmmnan 251 Index 285 www.it-ebooks.info Contents About the author About the technical reviewer mmmxvif Introduction ■■■■■■■■■■ Chapter 1: Getting Started with Go ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ Introducing go Minimalistic Language with Pragmatic Design A Static Type Language with High Productivity 日日日日日日自日面日日面日日自日日自日面日日日日日日自日面日日日日自目日自重日面 2 Concurrency Is a Built-In Feature at the Language Level 2 Go Compiles Programs Quickly................................ Go as a General-Purpose Language....................................3 Go Ecosystem Installing the go tools Checking the Installation Setting up a Work environment. 7 G0 Workspace....…7 GOPATH Environment variable Code organization Paths Writing Go Programs 8 Writing a hello world program…........,,………8 Writing a Library 日B日面B日面日日Ba自面日面日日面面日日面面日B日面日日面面日自日日面面日日日面面日自日日日面面日自日日自面日日自日面面日自日日面日日日面 Testing go code Using go playground 12 www.it-ebooks.info CONTENTS Using Go Mobile∴ 13 Go as a Language for Web and Microservices 13 Summary ,14 Chapter 2: Go Fundamentals ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 15 Packages...............15 Package main 15 Package alias 16 Function init 16 Using a blank ldentifi 17 Importing Packages 8 Install Third-Party Packages.........................................18 Writing Packages Go Too 21 Formatting Go Code.….,,,,…, ,日面a面面面,日面面a日面面面面日面面量日面面面日B日面面 22 Go Documentation Working with Collections 24 rays…… 24 Slices 25 Maps 29 Defer panic and recover 31 Defer……………………………………… 31 Panic 32 Recover wwww 32 Error Handling… 33 Summary 34 Chapter 3: User-Defined Types and concurrency 35 User-defined Types with Structs 35 Creating a Struct Type .. Creating Instances of Struct Types 36 Adding Behavior to a Struct Type. www.it-ebooks.info CONTENT Type composition 40 Overriding Methods of Embedded type 43 Working with Interfaces ,44 Concurrency… 50 Goroutines 50 GOMAXPROCS and Parallelism Channels 54 Summary 58 Chapter4: Getting Started with Web Development,,,,,,,…,……59 net/httpPackage 59 Processing Http Requests 60 ServeMux… Hand|er,,……… Building a Static Web Server. 61 Creating Custom Handlers .63 Using Functions as Handlers.ammmmnannemmnnemannmannmann, 64 httpHandlerfunctype......m.........e............................................................................64 Servemuxhandlefuncfunctionwwwww.66 DefaultserveMux 66 httpServerStruct 67 Gorilla mux 69 Building a REStful APl 70 Data model and data store Configuring the Multiplexer…....,.,.,.,,.,… Handler Functions for CRUD Operations ….74 Summary… www.it-ebooks.info CONTENTS Chapter 5: Working with Go Templates mma maammmammmmaammmamm 79 text/template Package Working with text/template..,.,.,…..….9 Define Named templates …83 Declaring variables 83 Using Pipes........,...,,...,,.,,… 84 Building hTMl views Using html/template 84 Building a Web Application….............,,…,…….85 Summary… 97 Chapter6: Http MIddleware,,,,,,,,,,,……,…99 Introductiontohttpmiddleware Writing Http Middleware 100 Howtowritehttpmiddleware 101 Writing a Logging Middleware ControllingtheflowofhttpMiddleware.........m...........103 Using third-Party Middleware 106 Using Gorilla handlers. 106 Middleware Chaining with the Alice Package...............................108 Using middleware with the Negroni package 111 Getting Started with Negroni........…….11 Working with a Negroni Middleware Stack 115 Sharing values Among Middleware 118 Using Gorilla context 118 Setting and getting Values with Gorilla context 118 Summary… 120 Chapter 7: Authentication to Web Apps mamm 121 Authentication and authorization ,121 Authentication Approaches.... aaaaa. 121 Cookie-Based Authentication 122 Token -Based authentication 123 ww. it-ebooks info CONTENTS Authentication with oauth 2 125 Understanding oauth 2 125 Authentication with OAuth 2 using the Goth Package 126 Authentication with json Web token 131 Working with JWT Using the jwt-go Package...........131 Using Http Middleware to validate Jwt Tokens Summary 139 Chapter 8: Persistence with MongoDB ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 141 Introduction to MongoDB ,141 Getting Started Using MongoDB ……………142 Introduction to mgo Driver for MongoDB 142 Accessing Collections…......,,…,…,…,……144 CRUD Operations with MongoDB 144 Inserting Documents…..,......,,….,144 Reading documents 149 Updating Documents… 151 Deleting documents Indexes in MongoDB 152 Managing Sessions …154 Summary 157 Chapter 9: Building restful services n. RESTful APIs: the Backbone of Digital Transformation 159 APl-Driven Development with RESTful APls 160 Go: the great stack for restful services∴…160 Go: the great stack for Building RESTful APls 162 Third-Party packages 62 Application Structure... ……162 Data model 164 Resource Modeling for RESTful APls 重日a日日日B日日面日日日面口日自日面日日日面日日自日面日日自日面日日自日日日自日自日日自日口 165 www.it-ebooks.info

3.53MB
Web Development with Go
2018-06-13Go language provides essential syntax and features that allows you to write your programs. These pro
Web Development with Go(pdf)下载_course
2020-08-12Go, often referred to as Golang, is a general-purpose programming language that was developed at Goo
1.84MB
Learning Go Web Development azw3
2017-09-23Learning Go Web Development 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
4.70MB
Web Development with Django Cookbook 英文清晰原版第2版
2019-03-01Web Development with Django Cookbook 第2版 This is the latest book on the market that will help you ta
5.14MB
Web Development with Go(Apress,2015)
2016-01-11Go, the open-source programming language originally developed at Google, makes it easy to build simp
5.86MB
Go Web Development Cookbook Build full-stack web applications with Go azw3
2018-05-11Go Web Development Cookbook Build full-stack web applications with Go 英文azw3 本资源转载自网络,如有侵权,请联系上传者或cs
2.43MB
Learning Go Web Development 无水印原版pdf
2018-03-13Learning Go Web Development 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可
Go Web 编程下载_course
2018-06-29008——Go Web 编程 008——Go Web 编程 008——Go Web 编程 008——Go Web 编程 相关下载链接://download.csdn.net/download/weix
Web Development with Go下载_course
2019-10-03Go language provides essential syntax and features that allows you to write your programs. These pro
4.12MB
web development with go
2017-11-27高清、标签 golang web开发英文版pdf文档,请大家放心下载
5.11MB
Web.Development.with.Go.Building.Scalable.Web.Apps.and.RESTful.Services
2016-01-14Go, the open-source programming language originally developed at Google, makes it easy to build simp
111.65MB
DirectX修复工具V4.0增强版
2020-06-13DirectX修复工具(DirectX Repair)是一款系统级工具软件,简便易用。本程序为绿色版,无需安装,可直接运行。 本程序的主要功能是检测当前系统的DirectX状态,如果发现异常则进行修复
23KB
自考项目论证与评估 --在线作业.docx
2020-07-15在线作业要求: 从一下题目中选择5道题目论述。 1. 结合实际项目案例,说明组织是如何开展项目论证与评估来支持决策的?开展了哪些具体方面的论证与评估? 2. 结合一个实际项目案例,对项目生命周期进行划
Java小白修炼手册
2019-12-28Java是一门面向对象编程语言,不仅吸收了C++语言的各种优点,还摒弃了C++里难以理解的多继承、指针等概念,因此Java语言具有功能强大和简单易用两个特征。Java语言作为静态面向对象编程语言的代表,极好地实现了面向对象理论,允许程序员以优雅的思维方式进行复杂的编程。 课程讲从零开始讲解Java 语言,小白快速入门学习的必修课!
68B
JAVA上百实例源码以及开源项目
2016-01-03百度云盘分享 简介 笔者当初为了学习JAVA,收集了很多经典源码,源码难易程度分为初级、中级、高级等,详情看源码列表,需要的可以直接下载! 这些源码反映了那时那景笔者对未来的盲目,对代码的热情、执着,
企业员工角色权限管理平台(SpringBoot2.0+Mybatis+Shiro+Vue)
2019-08-07课程简介: 历经半个多月的时间,Debug亲自撸的 “企业员工角色权限管理平台” 终于完成了。正如字面意思,本课程讲解的是一个真正意义上的、企业级的项目实战,主要介绍了企业级应用系统中后端应用权限的管理,其中主要涵盖了六大核心业务模块、十几张数据库表。 其中的核心业务模块主要包括用户模块、部门模块、岗位模块、角色模块、菜单模块和系统日志模块;与此同时,Debug还亲自撸了额外的附属模块,包括字典管理模块、商品分类模块以及考勤管理模块等等,主要是为了更好地巩固相应的技术栈以及企业应用系统业务模块的开发流程! 核心技术栈列表: 值得介绍的是,本课程在技术栈层面涵盖了前端和后端的大部分常用技术,包括Spring Boot、Spring MVC、Mybatis、Mybatis-Plus、Shiro(身份认证与资源授权跟会话等等)、Spring AOP、防止XSS攻击、防止SQL注入攻击、过滤器Filter、验证码Kaptcha、热部署插件Devtools、POI、Vue、LayUI、ElementUI、JQuery、HTML、Bootstrap、Freemarker、一键打包部署运行工具Wagon等等,如下图所示: 课程内容与收益: 总的来说,本课程是一门具有很强实践性质的“项目实战”课程,即“企业应用员工角色权限管理平台”,主要介绍了当前企业级应用系统中员工、部门、岗位、角色、权限、菜单以及其他实体模块的管理;其中,还重点讲解了如何基于Shiro的资源授权实现员工-角色-操作权限、员工-角色-数据权限的管理;在课程的最后,还介绍了如何实现一键打包上传部署运行项目等等。如下图所示为本权限管理平台的数据库设计图: 以下为项目整体的运行效果截图: 值得一提的是,在本课程中,Debug也向各位小伙伴介绍了如何在企业级应用系统业务模块的开发中,前端到后端再到数据库,最后再到服务器的上线部署运行等流程,如下图所示:
Windows版YOLOv4目标检测实战:人脸口罩佩戴检测
2020-05-20课程演示环境:Windows10;CUDA10.2; cuDNN 7.6.5; Python 3.7; Visual Studio 2019; OpenCV3.4 需要学习Ubuntu系统YOLOv4的同学请前往《YOLOv4目标检测实战:人脸口罩佩戴检测》 课程链接:https://edu.csdn.net/course/detail/28860 当前,人脸口罩佩戴检测是急需的应用,而YOLOv4是新推出的强悍的目标检测技术。本课程使用YOLOv4实现人脸口罩佩戴的实时检测。课程提供超万张已标注人脸口罩数据集。训练后的YOLOv4可对真实场景下人脸口罩佩戴进行高精度地实时检测。 本课程会讲述本项目超万张人脸口罩数据集的制作方法,包括使用labelImg标注工具标注以及如何使用Python代码对第三方数据集进行修复和清洗。 本课程的YOLOv4使用AlexyAB/darknet,在Windows系统上做人脸口罩佩戴检测项目演示。具体项目过程包括:安装YOLOv4、训练集和测试集自动划分、修改配置文件、训练网络模型、测试训练出的网络模型、性能统计(mAP计算)和先验框聚类分析。
84.55MB
微信小程序源码-合集4.rar
2020-09-04微信小程序源码,包含:3C手机商城、kindle图书商城、大宅小屋拼团、球鞋商城、扫码购物、一元夺宝、喜茶店铺、京东首页、京东白条、小米商城等35个商城类源码。
41.55MB
25个经典网站源代码
2013-06-0925个经典网站源代码 有简约的有时尚的方便大家参考、模仿。
程序员的数学:线性代数
2019-09-26编程的基础是计算机科学,而计算机科学的基础是数学。因此,学习数学有助于巩固编程的基础,写出更健壮的程序。程序员的数学系列课程主要讲解程序员必备的数学知识,借以培养程序员的数学思维。学习者无需精通编程,也无需精通数学。从概率统计、线性代数、微积分、优化理论、随机过程到当前大热的机器学习,讲师幽默风趣,课件精致美观,深入浅出带你重学数学,时间不可重来,知识可以重学!
高并发下的Nginx性能优化实战
2019-12-24【超实用课程内容】 本课程内容包含讲解解读Nginx的基础知识,解读Nginx的核心知识、带领学员进行高并发环境下的Nginx性能优化实战,让学生能够快速将所学融合到企业应用中。 【课程如何观看?】 PC端:https://edu.csdn.net/course/detail/27216 移动端:CSDN 学院APP(注意不是CSDN APP哦) 本课程为录播课,课程永久有效观看时长,大家可以抓紧时间学习后一起讨论哦~ 【学员专享增值服务】 源码开放 课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化 下载方式:电脑登录https://edu.csdn.net/course/detail/27216,播放页面右侧点击课件进行资料打包下载
12.91MB
微信小程序源码-合集3.rar
2020-09-04微信小程序源码,包含:汤总便利、茶铺门店、滴滴拼车、同城拼车(带后台)、企业OA系统、房地产公司展示、华云智慧园区、汽车维修、评测、停车等源码。
Java学习指南(Java入门与进阶)
2017-08-09这是Java学习指南系列课程的第1篇,介绍Java语言的入门语法,引领希望学习Java语言编程的初学者进入Java大门。 本课程不需要其他语言作为基础,可以直接学习。 课程从Java开发平台的下载和安装开始,从浅到深、从易到难,循序渐进地进行语法讲解。 为了让学员更好的掌握Java语言,本课程配套在线的Java题库及答案解析。 相比于其他语言,Java语言更科学、更容易掌握,快来和大家一起学习Java吧。
- 【2021 第一期】日常开发 26 个常见的 JavaScript 代码优化方案 86362021-02-18大伙儿好~,我是小鹿,公众号:「小鹿动画学编程」 原创作者。 时隔半年我又回来了,期间发生了很多事情。从大学刚毕业来到一线找工作,也由于今年出现的特殊情况,掘金断就更了一段时间。嗯~,就不给自己找借口啦。现在全部安顿好了,把精力开始慢慢回归到写作上,希望在 2021 新的一年和大伙儿一起在掘金成长! 2021 第一期。 本篇文章整理了在日常开发中 30 个常见的 JavaScript 代码优化方案。 本文章已在 Github blog 收录,欢迎大伙儿~ Star,文章中若存在不足或者 issues.
-
博客
springcloud-gateway源码-(十)Ribbon负载均衡导图
springcloud-gateway源码-(十)Ribbon负载均衡导图
-
下载
ApacheFlink漫谈系列-概述
ApacheFlink漫谈系列-概述
-
学院
DHCP 动态主机配置服务(在Linux环境下,配置单网段或跨网段提)
DHCP 动态主机配置服务(在Linux环境下,配置单网段或跨网段提)
-
下载
UL 153:2020 Portable Electric Luminaires(便携灯具)- 最新完整英文版(204页)
UL 153:2020 Portable Electric Luminaires(便携灯具)- 最新完整英文版(204页)
-
下载
使用Jenkins搭建iOS/Android持续集成打包平台
使用Jenkins搭建iOS/Android持续集成打包平台
-
下载
APPKIT打造稳定、灵活、高效的运营配置平台
APPKIT打造稳定、灵活、高效的运营配置平台
-
博客
Java实现基数排序算法
Java实现基数排序算法
-
博客
sync_with_stdio和cin.tie(0); cout.tie(0);
sync_with_stdio和cin.tie(0); cout.tie(0);
-
学院
一天学完MySQL数据库
一天学完MySQL数据库
-
下载
ASHRAE 2012 IT Equipment Thermal Management and Controls_V1.0.pdf
ASHRAE 2012 IT Equipment Thermal Management and Controls_V1.0.pdf
-
博客
洛谷P5724 【深基4.习5】求极差经典解法
洛谷P5724 【深基4.习5】求极差经典解法
-
下载
聊聊分布式事务,再说说解决方案
聊聊分布式事务,再说说解决方案
-
博客
python的多线程能否实现并发,游学电子告诉您
python的多线程能否实现并发,游学电子告诉您
-
博客
Codeforces1485 A. Add and Divide(枚举)
Codeforces1485 A. Add and Divide(枚举)
-
学院
龙芯生态应用开发基础:C语言精要
龙芯生态应用开发基础:C语言精要
-
博客
别再这么写代码了,这几个方法不香吗?
别再这么写代码了,这几个方法不香吗?
-
学院
自动化测试Python3+Selenium3+Unittest
自动化测试Python3+Selenium3+Unittest
-
博客
LeetCode 867 转置矩阵 HERODING的LeetCode之路
LeetCode 867 转置矩阵 HERODING的LeetCode之路
-
博客
要清楚一个工程里有哪些有多少个ROS功能包,最快的方法就是直接在工程里搜索package.xml或者CMakeLists.txt
要清楚一个工程里有哪些有多少个ROS功能包,最快的方法就是直接在工程里搜索package.xml或者CMakeLists.txt
-
下载
百亿级日志系统架构设计及优化
百亿级日志系统架构设计及优化
-
下载
Kubernetes下日志采集、存储与处理技术实践
Kubernetes下日志采集、存储与处理技术实践
-
下载
两种新的具有最优修复的2位奇偶校验MDS阵列代码
两种新的具有最优修复的2位奇偶校验MDS阵列代码
-
学院
access应用的3个开发实例
access应用的3个开发实例
-
下载
详解敏捷测试
详解敏捷测试
-
博客
php、jsp、asp和aspx的区别
php、jsp、asp和aspx的区别
-
学院
MySQL你该了解的那些事【服务端篇】
MySQL你该了解的那些事【服务端篇】
-
学院
使用 Linux 平台充当 Router 路由器
使用 Linux 平台充当 Router 路由器
-
学院
Jsplumb从入门到实战
Jsplumb从入门到实战
-
学院
简单增删查改新闻管理系统
简单增删查改新闻管理系统
-
博客
2021-2-25:对于 Java MMAP,如何查看文件映射脏页,如何统计MMAP的内存大小?
2021-2-25:对于 Java MMAP,如何查看文件映射脏页,如何统计MMAP的内存大小?