Skip to content
This repository was archived by the owner on Aug 3, 2025. It is now read-only.

Commit 8ddfb85

Browse files
committed
Added the groot-request-service to the api-gateway
1 parent 0d0ac58 commit 8ddfb85

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

config/config.go.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const MerchURL = "http://localhost:6969"
2121
const NotificationURL = "http://localhost:1122"
2222
const QuotesURL = "http://localhost:9494"
2323
const RecruiterURL = "http://localhost:4567"
24+
const RequestURL = "http://localhost:5656"
2425
const UsersURL = "http://localhost:8001"
2526

2627
//Arbor configurations

services/request.go

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* Copyright © 2017, ACM@UIUC
3+
*
4+
* This file is part of the Groot Project.
5+
*
6+
* The Groot Project is open source software, released under the University of
7+
* Illinois/NCSA Open Source License. You should have received a copy of
8+
* this license in a file with the distribution.
9+
**/
10+
11+
package services
12+
13+
import (
14+
"net/http"
15+
16+
"github.com/acm-uiuc/arbor"
17+
"github.com/acm-uiuc/groot-api-gateway/config"
18+
)
19+
20+
//Location
21+
const RequestURL string = config.RequestURL
22+
23+
//Service Data Type
24+
const RequestFormat string = "JSON"
25+
26+
//API Interface
27+
var RequestRoutes = arbor.RouteCollection{
28+
arbor.Route{
29+
"PostRequest",
30+
"POST",
31+
"/request",
32+
PostRequest,
33+
},
34+
arbor.Route{
35+
"GetRequest",
36+
"GET",
37+
"/request",
38+
GetRequest,
39+
},
40+
arbor.Route{
41+
"GetRequestByID",
42+
"GET",
43+
"/request/{id}",
44+
GetRequestByID,
45+
},
46+
arbor.Route{
47+
"UpdateRequest",
48+
"PUT",
49+
"/request/{id}",
50+
UpdateRequest,
51+
},
52+
}
53+
54+
// arbor.Route handler
55+
func PostRequest(w http.ResponseWriter, r *http.Request) {
56+
arbor.POST(w, RequestURL+r.URL.String(), RequestFormat, "", r)
57+
}
58+
59+
func GetRequest(w http.ResponseWriter, r *http.Request) {
60+
arbor.GET(w, RequestURL+r.URL.String(), RequestFormat, "", r)
61+
}
62+
63+
func GetRequestByID(w http.ResponseWriter, r *http.Request) {
64+
arbor.GET(w, RequestURL+r.URL.String(), RequestFormat, "", r)
65+
}
66+
67+
func UpdateRequest(w http.ResponseWriter, r *http.Request) {
68+
arbor.PUT(w, RequestURL+r.URL.String(), RequestFormat, "", r)
69+
}

0 commit comments

Comments
 (0)