/GO_dock

dockerize

Primary LanguageGo

Backend Elastic Client

Setup

  • Requirements

    • Elasticsearchdb
    • Imports listed in import section
import (
 "context"
"log"
// "encoding/json"
"fmt"
"net/http"
"math"
"reflect"
"strconv"
"time"
elastic "gopkg.in/olivere/elastic.v5"
"github.com/speps/go-hashids"
 "github.com/gin-gonic/gin"
 "github.com/gin-contrib/cors"

)

go get github.com/speps/go-hashids
github.com/gin-gonic/gin
github.com/gin-contrib/cors

Build & Run

elasticsearch
go build main.go
./main

Endpoints

  • Create (Generate short url in DB)
  • Get short url (Get)
  • ** Get original Url**
    • URL a href> localhost:8000/redirect/:hash
    • Data Contract
      • Method - GET
      • Response type JSON {url:""}