...

Source file src/gitlab.hexacode.org/go-libs/microservice/example/main.go

Documentation: gitlab.hexacode.org/go-libs/microservice/example

     1  /*
     2   * Micro Service
     3   * Package: gitlab.hexacode.org/go-libs/microservice
     4   * Maintainer: Azzis Arswendo <azzis@hexacode.org>
     5   *
     6   * Copyright (C) 2023 Hexacode Teknologi Indonesia
     7   * All Rights Reserved
     8   */
     9  
    10  package main
    11  
    12  import (
    13  	"fmt"
    14  
    15  	"gitlab.hexacode.org/go-libs/hctypes"
    16  	"gitlab.hexacode.org/go-libs/microservice/config"
    17  )
    18  
    19  func Registration(ctx *config.ConfigContext) (int, hctypes.Dict, *config.ReturnHTTPError) {
    20  	fmt.Println(ctx.Config.ToDict().ToColoredJson())
    21  	fmt.Println(ctx.ConfigApi.ToDict().ToColoredJson())
    22  	fmt.Println(ctx.URLParams.ToColoredJson())
    23  	fmt.Println(ctx.Params.ToColoredJson())
    24  	fmt.Println(ctx.Headers.ToColoredJson())
    25  
    26  	return 200, hctypes.Dict{
    27  		"id":  1,
    28  		"otp": 123456,
    29  	}, nil
    30  }
    31  
    32  func Verification(ctx *config.ConfigContext) (int, hctypes.Dict, *config.ReturnHTTPError) {
    33  	fmt.Println(ctx.Config.ToDict().ToColoredJson())
    34  	fmt.Println(ctx.ConfigApi.ToDict().ToColoredJson())
    35  	fmt.Println(ctx.URLParams.ToColoredJson())
    36  	fmt.Println(ctx.Params.ToColoredJson())
    37  	fmt.Println(ctx.Headers.ToColoredJson())
    38  
    39  	return 200, hctypes.Dict{
    40  		"success": true,
    41  		"message": "OTP verified",
    42  	}, nil
    43  }
    44  

View as plain text