Giter VIP home page Giter VIP logo

link-tracker's Introduction

link-tracker

This repository serves as a starting point for building web services. It uses minimal dependencies, implements idiomatic code and follows as much as possible the following best practices:

It also includes a makefile whose default target run the following tools:

  • go mod tidy
  • go fmt
  • goimports
  • go test

Go installation

  • Download Go tools from https://golang.org/dl
  • If you are on a Unix-like system using bash, add the following lines to your .profile:
    • export GOPATH=$HOME/go
    • export PATH=$PATH:$GOPATH/bin

Note: Despite being mentioned in many blog posts, there is no need to define GOROOT.

Build locally

After cloning the repository, execute the following command under the root directory

make run

The main branch does not use any framework. It relies on simple primitives built on top of the standard library. Here you will find the same program using the gin framework. It is worth noting that despite changing the entire transport implementation, the domain layer remains intact.

Business Problem

This project provides a web service for creating and redirecting URLs upon password validation. It also tracks how many times a URL is visited with a simple counter. As implementation note, the service is not thread safe, and the repository is volatile, meaning that the default implementation stores the data in memory.

Create a link

curl -POST http://localhost:8080/link -d '{"link":"https://www.google.com", "password":"123"}'

Open a link

You can either use cURL and follow the redirection with -L or opening a browser and navigate to the link. For a link with id 1 please visit: http://localhost:8080/link/1?password=123

Acknowledgement

All the content in this repository is heavily inspired by the amazing work done by Bill Kennedy from ArdanLabs.

I strongly recommend taking any of his courses and check many useful links and open-source material in his repository.

link-tracker's People

Contributors

emacampolo avatar

Stargazers

Martin Viggiano avatar Ricardo Perez avatar Mateo Ferrari Coronel avatar

Watchers

 avatar

Forkers

mateoferrari97

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.