Skip to content

Latest commit

 

History

History
82 lines (68 loc) · 1.63 KB

readme.md

File metadata and controls

82 lines (68 loc) · 1.63 KB

VK-Tarantool

Table of contents:

How to run locally 💻:

  1. Run tarantool in docker
docker run --name mytarantool -d -p 3301:3301 \
tarantool/tarantool:2.6.0

⚠️ if run on ARM - then use version 2.10.0-beta1

  1. Enter in container with docker exec
  2. Create schemas:
s = box.schema.space.create('short')

s:format({
{name = 'shorted', type = 'string'},
{name = 'original', type = 'string'},
{name = 'created_by', type = 'string'}
})

s:create_index('primary', {
         type = 'hash',
         parts = {'shorted'}
         })
t = box.schema.space.create('transitions')

t:format({
{name = 'id', type = 'string'},
{name = 'shorted', type = 'string'},
{name = 'ip', type = 'string'},
{name = 'ua', type = 'string'}
})

t:create_index('primary', {
         type = 'hash',
         parts = {'id'}
         })
  1. Create index
t:create_index('shorted_idx', { type = 'tree', unique = false, parts = {'shorted'} })
  1. Run with command:
go run cmd/shorter/main.go

Server is now running on port 8182

Deployed version:

Send http requests below to deployed version of service at address: http://37.139.34.190/

API Endpoints:

  1. Set endpoint
/set?url=http://vk.com/ac

⚠️ URL must be with scheme (http:// or https://)

  1. Get endpoint
/{hash_from_previous_request}

Analytics

Analytics is available from web UI after creating first short link