FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
hello-localhttps/https-server.go at master · gavinzhou/hello-localhttps · GitHub
gavinzhou
hello-localhttps
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
hello-localhttps
/
https-server.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
19 lines (16 loc) · 412 Bytes
Breadcrumbs
hello-localhttps
/
https-server.go
Copy path
File metadata and controls
19 lines (16 loc) · 412 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package
main
import
(
"log"
"net/http"
)
func
handler
(
w
http.
ResponseWriter
,
r
*
http.
Request
) {
w
.
Header
().
Set
(
"Content-Type"
,
"text/plain"
)
w
.
Write
([]
byte
(
"Hi, This is an example of https server in golang!
\n
"
))
}
func
main
() {
http
.
HandleFunc
(
"/"
,
handler
)
err
:=
http
.
ListenAndServeTLS
(
":4433"
,
"localhost+3.pem"
,
"localhost+3-key.pem"
,
nil
)
if
err
!=
nil
{
log
.
Fatal
(
"ListenAndServe: "
,
err
)
}
}
Back
|
FazBrowse Home
|
New Git URL