-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from eaceto/development
Release 1.0.1
- Loading branch information
Showing
24 changed files
with
711 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* ReGraphQL - Proxy | ||
* This is the proxy service of project ReGraphQL | ||
* | ||
* Contact: ezequiel.aceto+regraphql@gmail.com | ||
*/ | ||
|
||
package app | ||
|
||
import ( | ||
"fmt" | ||
"github.com/gorilla/mux" | ||
) | ||
|
||
type Application struct { | ||
Router *mux.Router | ||
Routes []Route | ||
Configuration *Configuration | ||
} | ||
|
||
func NewApplication(rootRouter *mux.Router) (*Application, error) { | ||
|
||
configuration, err := NewConfiguration() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
configuration.log() | ||
|
||
routes, err := configuration.loadRoutesFromFiles() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if len(routes) == 0 { | ||
return nil, fmt.Errorf("no routes available in config path: %s", configuration.RouterConfigsPath) | ||
} | ||
|
||
router, err := configuration.addServiceHTTPRouter(rootRouter, routes) | ||
if router == nil { | ||
return nil, fmt.Errorf("could not create HTTP router") | ||
} | ||
|
||
return &Application{ | ||
Router: router, | ||
Routes: routes, | ||
Configuration: configuration, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.