-
- 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
elasticsearch
go build main.go
./main
- Create (Generate short url in DB)
- url localhost:8000/create
- Data Contract
- method - POST
- (Type: application/x-www-form-urlencoded)
- {url:""}
- Get short url (Get)
- url localhost:8000/pretty/:orig
- Data Contract
- Method - GET
- Response type JSON {url:""}
- ** Get original Url**
- URL a href> localhost:8000/redirect/:hash
- Data Contract
- Method - GET
- Response type JSON {url:""}