FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
auth-dev/main.go at develop · fun-dev/auth-dev · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
fun-dev
/
auth-dev
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
auth-dev
/
main.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (42 loc) · 1.08 KB
Breadcrumbs
auth-dev
/
main.go
Copy path
File metadata and controls
55 lines (42 loc) · 1.08 KB
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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package
main
import
(
"database/sql"
"log"
"net/http"
"github.com/fun-dev/auth-dev/auth"
_
"github.com/go-sql-driver/mysql"
"github.com/gorilla/mux"
)
func
signup
(
w
http.
ResponseWriter
,
r
*
http.
Request
) {
auth
.
Signup
(
w
,
r
)
}
func
login
(
w
http.
ResponseWriter
,
r
*
http.
Request
) {
auth
.
Login
(
w
,
r
)
}
func
removeAccount
(
w
http.
ResponseWriter
,
r
*
http.
Request
) {
auth
.
RemoveAccount
(
w
,
r
)
}
var
db
*
sql.
DB
func
main
() {
db
,
err
:=
sql
.
Open
(
"mysql"
,
auth
.
DBLocation
())
if
err
!=
nil
{
log
.
Println
(
err
)
return
}
err
=
db
.
Ping
()
if
err
!=
nil
{
log
.
Println
(
err
)
return
}
db
.
Close
()
// urls.py
router
:=
mux
.
NewRouter
()
// endpoint
router
.
HandleFunc
(
"/signup"
,
signup
).
Methods
(
"POST"
)
router
.
HandleFunc
(
"/login"
,
login
).
Methods
(
"POST"
)
router
.
HandleFunc
(
"/removeAccount"
,
removeAccount
).
Methods
(
"POST"
)
// console に出力する
log
.
Println
(
"サーバー起動 : 8000 port で受信"
)
// log.Fatal は、異常を検知すると処理の実行を止めてくれる
log
.
Fatal
(
http
.
ListenAndServe
(
":8000"
,
router
))
}
Back
|
FazBrowse Home
|
New Git URL