Help on Rest Webservice

Hi All,

Need help on Rest Webservices thoughts. I am using Gorilla toolkit for designing REST API.
Previously in Java/Python world I have designed below approaches for common validations (Authentication, Logger, Content-Type, Return-Type, Roles) for any service method invocations.

  1. Authentication - X-Auth-Token reading from the header and validating the token then routing to approapriate service method in python or java.
  2. Similarly Logger, Request format, Return type validations as well.

How to achieve this in Go with Gorilla, since Java/Python are object oriented will be invoked as the base class constructor.

Please suggest your thoughts in this regard.

Thanks
Swaroop

Hi,

I’d suggest going through some of the articles in the LearnServerProgramming wiki

It sounds that what you are trying to do should be solved by writing middleware chains (similar to Python decorators) for each seperate operation or define one handler function that do general operations before or after handling the specific request as described here

Pieter

also try Go in 5 Minutes, episode 3.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.