Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
D
Data Broker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mohamad.alturky
Data Broker
Commits
36e8b969
Commit
36e8b969
authored
Mar 21, 2024
by
mohamad.alturky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding rest server
parent
6af138a7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
main.go
src/main.go
+1
-1
Server.go
src/server/Server.go
+4
-4
No files found.
src/main.go
View file @
36e8b969
...
@@ -3,7 +3,7 @@ package main
...
@@ -3,7 +3,7 @@ package main
import
Presentation
"data_broker/server"
import
Presentation
"data_broker/server"
func
main
()
{
func
main
()
{
server
:=
Presentation
.
Server
{}
server
:=
Presentation
.
Restful
Server
{}
server
.
Init
()
server
.
Init
()
server
.
MapRoutes
()
server
.
MapRoutes
()
server
.
Start
(
"localhost:5898"
)
server
.
Start
(
"localhost:5898"
)
...
...
src/server/Server.go
View file @
36e8b969
...
@@ -7,20 +7,20 @@ import (
...
@@ -7,20 +7,20 @@ import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
)
)
type
Server
struct
{
type
Restful
Server
struct
{
engine
gin
.
Engine
engine
gin
.
Engine
}
}
func
(
server
*
Server
)
Init
()
{
func
(
server
*
Restful
Server
)
Init
()
{
server
.
engine
=
*
gin
.
Default
()
server
.
engine
=
*
gin
.
Default
()
}
}
func
(
server
*
Server
)
MapRoutes
()
{
func
(
server
*
Restful
Server
)
MapRoutes
()
{
server
.
engine
.
GET
(
"/channels/:channel"
,
ChannelsRoutes
.
Pull
)
server
.
engine
.
GET
(
"/channels/:channel"
,
ChannelsRoutes
.
Pull
)
server
.
engine
.
GET
(
"/data/:channel/:key"
,
DataRoutes
.
Pull
)
server
.
engine
.
GET
(
"/data/:channel/:key"
,
DataRoutes
.
Pull
)
server
.
engine
.
POST
(
"/data/push"
,
DataRoutes
.
Push
)
server
.
engine
.
POST
(
"/data/push"
,
DataRoutes
.
Push
)
}
}
func
(
server
*
Server
)
Start
(
url
string
)
{
func
(
server
*
Restful
Server
)
Start
(
url
string
)
{
server
.
engine
.
Run
(
url
)
server
.
engine
.
Run
(
url
)
}
}
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