6
6
"github.com/krishpranav/gorestapi/api/aboutapi"
7
7
"github.com/krishpranav/gorestapi/api/album"
8
8
"github.com/krishpranav/gorestapi/api/artist"
9
+ "github.com/krishpranav/gorestapi/api/profile"
9
10
"log"
10
11
"net/http"
11
12
)
@@ -30,6 +31,10 @@ var artists = []artist.Artist {
30
31
{Name : "ArtistFive" , Location : "USA" , JoinedAt : 2021 },
31
32
}
32
33
34
+ var profile = []aboutme.Aboutme {
35
+ {User : "UserOne" , JoinedAt : 2020 , Toptracks : "Song1, Song2, Song3" , Following : "ArtistOne" },
36
+ }
37
+
33
38
var mainpage = "Hello World"
34
39
35
40
func main () {
@@ -39,13 +44,14 @@ func main() {
39
44
40
45
api := router .Group ("/api" )
41
46
{
42
- api .GET ("/albums" , getAlbums )
43
- router .GET ("/albums/:id" , getAlbumByID )
47
+ router .GET ("/albums" , getAlbums )
48
+ api .GET ("/albums/:id" , getAlbumByID )
44
49
router .POST ("/albums" , postAlbums )
45
50
router .GET ("/about" , getAbout )
46
51
router .GET ("/artist" , getArtistData )
47
52
router .POST ("/artist" , postArtist )
48
53
router .GET ("/" , getMain )
54
+ router .GET ("/profile" , getProfile )
49
55
50
56
}
51
57
@@ -58,6 +64,10 @@ func main() {
58
64
router .Run ("localhost:8080" )
59
65
}
60
66
67
+ func getProfile (c * gin.Context ) {
68
+ c .IndentedJSON (http .StatusOK , profile )
69
+ }
70
+
61
71
func getAlbums (c * gin.Context ) {
62
72
c .IndentedJSON (http .StatusOK , albums )
63
73
}
0 commit comments