Skip to content

nomuyoshi/bit-url-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URL短縮サービス

$ curl -X POST https://mo68vfaxn5.execute-api.ap-northeast-1.amazonaws.com/Prod/bits -d '{"url":"https://news.yahoo.co.jp/topics"}'
=> {"url":"https://mo68vfaxn5.execute-api.ap-northeast-1.amazonaws.com/Prod/bits/e7ibhnzqExZ"}

requirement

環境構築

build

$ git clone git@github.com:nomuyoshi/bit-url-go.git
$ cd bit-url-go
$ sam build

docker

$ docker network create lambda-local
$ docker-compose up -d

dynamodb-local

$ aws dynamodb create-table --cli-input-json file://local/dynamo-table.json --endpoint-url http://localhost:8000
$ aws dynamodb list-tables --endpoint-url http://localhost:8000

ローカル実行

$ docker-compose up -d
$ sam local start-api --docker-network lambda-local --parameter-overrides='Salt="bit-url-local" BaseUrl="http://localhost:3000/"'
$ curl -X POST http://127.0.0.1:3000/bits -d '{"url":"https://example.com"}'

ディレクトリ

  • bit/ -> URL短縮処理
  • redirect/ -> 短縮URLでアクセスしたときのリダイレクト処理
  • db/ -> DynamoDBへのデータ保存、データ取得処理

About

URL短縮サービスLabmda+DynamoDB (AWS SAM)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published