Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython-lwan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Bryton Lacquement
cython-lwan
Commits
099de8fa
Commit
099de8fa
authored
Jun 21, 2018
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Go server
parent
8d37b2ff
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
README.md
README.md
+9
-0
golang/server.go
golang/server.go
+34
-0
No files found.
README.md
View file @
099de8fa
...
...
@@ -25,3 +25,12 @@ make run
```
Your server should be listening on
`0.0.0.0:8080`
.
## Golang
A Go HTTP server is also provided for comparison. It uses the standard "net/http" package. To run it:
```
shell
go run golang/server.go
```
golang/server.go
0 → 100644
View file @
099de8fa
package
main
import
(
"fmt"
"net/http"
//"runtime"
)
func
handle_root
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
fmt
.
Fprint
(
w
,
"Hello, World!"
)
}
func
fibonacci
(
n
uint32
)
uint32
{
var
i
,
a
,
b
uint32
a
,
b
=
0
,
1
for
i
=
0
;
i
<
n
;
i
++
{
a
,
b
=
b
,
a
+
b
}
return
a
}
func
handle_fibonacci
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
fmt
.
Fprintf
(
w
,
"Fibonacci(10^6) = %d (with overflow)
\n
"
,
fibonacci
(
1000000
))
}
func
main
()
{
//runtime.GOMAXPROCS(2)
http
.
HandleFunc
(
"/"
,
handle_root
)
http
.
HandleFunc
(
"/fibonacci"
,
handle_fibonacci
)
fmt
.
Println
(
"Serving on :8080"
)
http
.
ListenAndServe
(
":8080"
,
nil
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment