File tree Expand file tree Collapse file tree 6 files changed +10
-5
lines changed Expand file tree Collapse file tree 6 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ require (
15
15
github.com/cloudwego/base64x v0.1.4 // indirect
16
16
github.com/cloudwego/iasm v0.2.0 // indirect
17
17
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
18
+ github.com/gin-contrib/cors v1.7.2 // indirect
18
19
github.com/gin-contrib/sse v0.1.0 // indirect
19
20
github.com/go-playground/locales v0.14.1 // indirect
20
21
github.com/go-playground/universal-translator v0.18.1 // indirect
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
11
11
github.com/davecgh/go-spew v1.1.1 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
12
12
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0 =
13
13
github.com/gabriel-vasile/mimetype v1.4.3 /go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk =
14
+ github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQw =
15
+ github.com/gin-contrib/cors v1.7.2 /go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E =
14
16
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE =
15
17
github.com/gin-contrib/sse v0.1.0 /go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI =
16
18
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU =
Original file line number Diff line number Diff line change 6
6
7
7
"authentication-service/routes"
8
8
"authentication-service/services"
9
+ "github.com/gin-contrib/cors"
9
10
"github.com/gin-gonic/gin"
10
11
"github.com/joho/godotenv"
11
12
)
@@ -19,6 +20,7 @@ func main() {
19
20
defer services .DisconnectDB ()
20
21
21
22
r := gin .Default ()
23
+ r .Use (cors .Default ())
22
24
routes .InitialiseRoutes (r )
23
25
port := os .Getenv ("PORT" )
24
26
if port == "" {
Original file line number Diff line number Diff line change 6
6
)
7
7
8
8
func InitialiseRoutes (r * gin.Engine ) {
9
- r .POST ("/register" , controllers .RegisterUser )
10
- r .POST ("/login" , controllers .LoginUser )
11
- r .GET ("/jwt" , controllers .TokenLogin )
9
+ r .POST ("/api/v1/ register" , controllers .RegisterUser )
10
+ r .POST ("/api/v1/ login" , controllers .LoginUser )
11
+ r .GET ("/api/v1/ jwt" , controllers .TokenLogin )
12
12
}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export default function LoginForm() {
18
18
const handleLogin = async ( e : React . FormEvent ) => {
19
19
e . preventDefault ( ) ;
20
20
setError ( '' ) ;
21
- const apiEndpoint = 'http://localhost:4040/login' ;
21
+ const apiEndpoint = 'http://localhost:4040/api/v1/ login' ;
22
22
const result = await fetch ( apiEndpoint , {
23
23
method : 'POST' ,
24
24
headers : {
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export default function SignUpPage() {
20
20
const handleSignUp = async ( e : React . FormEvent ) => {
21
21
e . preventDefault ( ) ;
22
22
setError ( '' ) ;
23
- const apiEndpoint = 'http://localhost:4040/register' ;
23
+ const apiEndpoint = 'http://localhost:4040/api/v1/ register' ;
24
24
const type = 'user' ;
25
25
const result = await fetch ( apiEndpoint , {
26
26
method : 'POST' ,
You can’t perform that action at this time.
0 commit comments