Giter Club home page Giter Club logo

sho's Introduction

Sho: Serverless URL Shortener

sho is a basic url shortener written in Go. Sho is a small API developed for those who want to shorten links to be used in business. It aims to shorten urls and redirecting requests that coming to the urls. No any additional feature. That's all.

Contributions and bug reports are welcome.

Stack

  • PostgreSQL
  • Golang
  • Redis

Endpoints

Short a URL

Request:

POST /

Try it via https://ts7p7oopf5.execute-api.us-east-2.amazonaws.com/dev

{
    "target: "https://beratnakip.com"
}

Response:

{
    "ID": 12,
    "CreatedAt": "2021-08-07T20:02:25.494307616+03:00",
    "UpdatedAt": "2021-08-07T20:02:25.494307616+03:00",
    "DeletedAt": null,
    "target": "http://beratnakip.com",
    "address": "BpLnfg"
}

Redirect

GET /{id}

Try it via https://ts7p7oopf5.execute-api.us-east-2.amazonaws.com/dev/3qNfHK

http://localhost:8010/9F3qNf

Development Requirements

Setup process

Installing dependencies & building the target

In this example we use the built-in sam build to automatically download all the dependencies and package our build target.
Read more about SAM Build here

The sam build command is wrapped inside of the Makefile. To execute this simply run

make

Local development

Invoking function locally through local API Gateway

    sam local start-api --env-vars env.json

If the previous command ran successfully you should now be able to hit the following local endpoint to invoke your function http://localhost:3000

SAM CLI is used to emulate both Lambda and API Gateway locally and uses our template.yaml to understand how to bootstrap this environment (runtime, where the source code is, etc.) - The following excerpt is what the CLI will read in order to initialize an API and its routes:

TODO

  • URL Statistics
  • Url Expire

LICENSE

sho is released under ¨the Apache License 2.0

sho's People

Contributors

beratn avatar

Watchers

 avatar

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.