• Stars
    star
    124
  • Rank 288,207 (Top 6 %)
  • Language
    Go
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

URL Shortener Service in Go

Synopsis

URL Shortener Service

Run

Run with Docker

docker-compose up

Code Example

Using CURL Generate shortener\

$ curl -H "Content-Type: application/json" -X POST -d '{"url":"www.google.com"}' http://localhost:8080/encode/
<!-- Response: -->
<!-- {"success":true,"response":"http://localhost:8080/1"} -->

Redirect Open url in your browser http://localhost:8080/bN

OR

curl http://localhost:8080/1

Get info for url shortener
curl http://localhost:8080/info/1

Response:

{
 "success":true,
 "response": {
    "url":"www.google.com",
    "visited":true,
    "count":1
 }
}

Motivation

..

Installation

You can install it using 'go get' or cloning the repository.

Use go get

# fetches the program
go get github.com/douglasmakey/ursho

# move to the app's directory
cd $GOPATH/src/github.com/douglasmakey/ursho

Cloning the repo

We'll use github.com/user as our base path. Create a directory inside your workspace in which to keep source code:

mkdir -p $GOPATH/src/github.com/douglasmakey cd "$_"

Clone repository or download and unrar in folder
git clone https://github.com/douglasmakey/ursho.git

Use GLIDE Package Management for Golang, for installation all packages

https://github.com/Masterminds/glide

Run glide install in the folder.

Select method of persistence

select the method of persistence, in which you going to work.
storage := &storages.Postgres{}

If selected Postgresql as Storage, create database

CREATE DATABASE ursho_db;

Add your config for the method of persistence and other options in file config.json\

{
  "server": {
    "host": "0.0.0.0",
    "port": "8080"
  },
  "options": {
    "prefix": "http://localhost:8080/"
  },
  "posgres": {
    "user": "postgres",
    "password": "mysecretpassword",
    "db": "ursho_db"
  }
}

API Reference

..

Tests

..

Contributors

..

License

A short snippet describing the license (MIT, Apache, etc.)

More Repositories

1

oauth2-example

A simple Oauth2 example with Go
HTML
150
star
2

tracking

A geospatial tracking service with Go and Redis
Go
51
star
3

go-fcm

Firebase Cloud Messaging library written in Go
Go
33
star
4

shelldon

Shelldon is your new Rust-powered buddy with GPT features! It’s not trying to be the ultimate GPT client—there are already a ton of those out there. Shelldon was born out of my personal need for a smarter CLI . It tackles some quirky use cases and makes my life easier, and hopefully yours too. Plus, who doesn’t love a fun side project?
Rust
24
star
5

admissioncontroller

A simple boilerplate for an admission controller in Go.
Go
23
star
6

cache-example

A few days ago, I read an article about BigCache and I was interested to know how they avoided these 2 problems: concurrent access and expensive GC cycles
Go
14
star
7

golang_api

PLEASE DON'T USE THIS IT WAS AN EXPERIMENT - A RESTful application boilerplate in Go using Echo + gorm with PostgreSQL and more.
Go
14
star
8

send-file-over-tcp-demo

Go
12
star
9

envi

Environment vars in Go.
Go
11
star
10

ebpf-learning

C
10
star
11

chatting-with-docs

This is an ultra-simple example of using Langchain, Chroma and OpenAI for chatting with your documents
Python
10
star
12

k8s-validating-admission-policy

CEL for admission controller with ValidatingAdmissionPolicy in K8s 1.26
8
star
13

dijkstra-heap

Simple implementation of Dijkstra using a heap in Golang
Go
8
star
14

go-sockets-uds-network-pprof

Go
8
star
15

socket-sharding

Go
6
star
16

tookan_api

python library for TookanApi
Python
6
star
17

poc-rust-https-sniffer

Rust
6
star
18

poc-ddos-xdp

A simple PoC of DDoS mitigation in Rust using XDP
Rust
5
star
19

isoserver

This repository hosts a simple Rust-based proof of concept (PoC) for implementing TCP and UDP echo servers, running in its own isolated network namespace. It's a exploration into advanced networking concepts in Rust, leveraging the power of network namespaces for process isolation and the Tokio runtime for asynchronous operations.
Rust
5
star
20

syn-ack

Rust
4
star
21

gitjump

The easiest way to navigate through commits in a git repository!
Go
3
star
22

streaming-go-socketio

Streaming in Go with Socketio
HTML
2
star
23

simple-proxy

Go
1
star
24

hackerrank

My personal hackerrank solutions
Go
1
star
25

pocketknife

A simple 📚 collection of Go functions, data and tidbits that I'm too lazy to write whenever I need it.
Go
1
star
26

go-algorithms-patterns

Go Examples of Common Patterns, Algorithms And More ....
Go
1
star
27

rat_shell

Go
1
star