See article at http://hire.jonasgalvez.com.br/2018/May/20/You-Dont-Need-REST.
go build
./pathway
curl -H "Content-Type: application/json" \
-d '{"test": 1}' http://0.0.0.0:4000/api/echo/message
An example EchoService is provided (echo_service.go). A real service may talk to other APIs or database services directly. Here's an auth proxy would look like:
type LoginCredentials struct {
email *string `json:"email"`
password *string `json:"passsword"`
}
func (s *AccountsService) Login(
ctx context.Context,
payload json.RawMessage,
) (
*json.RawMessage,
*Response,
error,
) {
log.Println("Accounts.Login called")
req, err := s.client.NewRequest("POST", "sessions/", &payload)
if err != nil {
return nil, nil, err
}
data := new(json.RawMessage)
resp, err := s.client.Do(ctx, req, &data)
if err != nil {
return nil, resp, err
}
return data, resp, nil
}
Stored E-commerce
Distributed under the MIT license. See LICENSE
for more information.
We're very much looking forward to Pull Requests enhancing features or addressing potential issues. As we further incorporate this into our infrastructure, we'll update this repo as well.
- Fork it (https://github.com/yourname/yourproject/fork)
- Create your feature branch (
git checkout -b feature/foo-bar
) - Commit your changes (
git commit -am 'Add some foo-bar'
) - Push to the branch (
git push origin feature/foo-bar
) - Create a new Pull Request