Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
covidcase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Abdulhadi Al-Sayed
covidcase
Commits
0be8fbb1
Commit
0be8fbb1
authored
4 years ago
by
Abdulhadi Al-Sayed
Browse files
Options
Downloads
Patches
Plain Diff
File reformatting to match assignment topic (packages, modules and procfiles)
parent
ac0f4ed7
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
api_infoservice.go
+4
-4
4 additions, 4 deletions
api_infoservice.go
cmd/exchange_server.go
+11
-11
11 additions, 11 deletions
cmd/exchange_server.go
go.mod
+1
-1
1 addition, 1 deletion
go.mod
procfile
+0
-1
0 additions, 1 deletion
procfile
with
16 additions
and
17 deletions
api_
exchang
e.go
→
api_
infoservic
e.go
+
4
−
4
View file @
0be8fbb1
package
exchang
e
package
covidcas
e
import
(
"covidcase/country"
"covidcase/currency"
"encoding/json"
"exchange/country"
"exchange/currency"
"fmt"
"github.com/go-chi/chi"
"html/template"
...
...
@@ -67,7 +67,7 @@ func HandlerLostUser(w http.ResponseWriter, r *http.Request) {
}
// HandlerHistory main handler for route related to `/exchangehistory` requests
func
Handler
Histo
ry
()
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
{
func
Handler
Count
ry
()
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
switch
r
.
Method
{
case
http
.
MethodGet
:
...
...
This diff is collapsed.
Click to expand it.
cmd/exchange_server.go
+
11
−
11
View file @
0be8fbb1
package
main
import
(
"
exchang
e"
"
covidcas
e"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"log"
...
...
@@ -16,12 +16,12 @@ import (
const
(
// Chi regex parameters
COUNTRY
=
"{country_name:[a-z]+}"
// Country name
BY
=
"{b_year:
\\
d
\\
d
\\
d
\\
d}"
// Begin year
BM
=
"{b_month:
\\
d
\\
d}"
// Begin month
BD
=
"{b_day:
\\
d
\\
d}"
// Begin day
EY
=
"{e_year:
\\
d
\\
d
\\
d
\\
d}"
// End year
EM
=
"{e_month:
\\
d
\\
d}"
// End month
ED
=
"{e_day:
\\
d
\\
d}"
// End day
//
BY = "{b_year:\\d\\d\\d\\d}" // Begin year
//
BM = "{b_month:\\d\\d}" // Begin month
//
BD = "{b_day:\\d\\d}" // Begin day
//
EY = "{e_year:\\d\\d\\d\\d}" // End year
//
EM = "{e_month:\\d\\d}" // End month
//
ED = "{e_day:\\d\\d}" // End day
)
func
main
()
{
...
...
@@ -40,10 +40,10 @@ func main() {
r
.
Use
(
middleware
.
Logger
)
// Routes
r
.
Get
(
"/
exchange/v1/exchangehistory/"
+
COUNTRY
+
"/"
+
BY
+
"-"
+
BM
+
"-"
+
BD
+
"-"
+
EY
+
"-"
+
EM
+
"-"
+
ED
,
exchange
.
HandlerHistory
())
r
.
Get
(
"/exchange/v1/exchangeborder/"
+
COUNTRY
,
exchang
e
.
HandlerBorder
())
r
.
Get
(
"/exchange/v1/diag/"
,
exchang
e
.
HandlerDiag
(
appStart
))
// Pass appStart time value for use in this route
r
.
Get
(
"/*"
,
exchang
e
.
HandlerLostUser
)
// Route for any other query not handled by API
r
.
Get
(
"/
corona/v1/country/"
+
COUNTRY
,
covidcase
.
HandlerCountry
())
// optional query parameter "scope" as start/end date
r
.
Get
(
"/exchange/v1/exchangeborder/"
+
COUNTRY
,
covidcas
e
.
HandlerBorder
())
r
.
Get
(
"/exchange/v1/diag/"
,
covidcas
e
.
HandlerDiag
(
appStart
))
// Pass appStart time value for use in this route
r
.
Get
(
"/*"
,
covidcas
e
.
HandlerLostUser
)
// Route for any other query not handled by API
log
.
Fatal
(
http
.
ListenAndServe
(
":"
+
port
,
r
))
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
go.mod
+
1
−
1
View file @
0be8fbb1
module
exchang
e
module
covidcas
e
// +heroku goVersion go1.13
...
...
This diff is collapsed.
Click to expand it.
procfile
deleted
100644 → 0
+
0
−
1
View file @
ac0f4ed7
web: exchange
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment