Giter Club home page Giter Club logo

short_url's Introduction

ShortUrl

MIT elixir

短链接生成应用

体验

预览地址

Gigalixir 提供免费部署服务,该地址只用于体验,:warning: 不提供数据维护存储。

预览图

image

系统设计

短网址(short URL)系统的原理及其实现

准备工作

安装elixir

http://elixir-lang.org/install.html

安装postgreSQL

首次运行

  • 安装依赖 mix deps.get
  • 创建数据库及数据表 mix ecto.create && mix ecto.migrate
  • 安装前端依赖 cd assets && yarn install
  • 启动服务 mix phx.server
  • 访问应用 localhost:4000

调试

进入控制台:

iex -S mix

格式化代码

mix format

部署

可以参考这篇文章 使用 edeliver 部署 Elixir 应用程序

API

短链接生成 API

## api/shorten
curl -X "POST" "http://localhost:4000/api/shorten" \
      -H 'Content-Type: application/json; charset=utf-8' \
      -d $'{
  "url": "https://www.github.com"
}'

批量短链接生成 API

## Mutil api/shorten
curl -X "POST" "http://localhost:4000/api/shorten/" \
      -H 'Content-Type: application/json; charset=utf-8' \
      -d $'{
  "url": [
    "https://gitlab.com",
    "https://github.com"
  ]
}'

短链接复原 API

## api/original
curl -X "POST" "http://localhost:4000/api/original/" \
      -H 'Content-Type: application/json; charset=utf-8' \
      -d $'{
  "url": "http://localhost:4000/zRa"
}'

配置

1、部署地址

2、短链域名

TODO

  • 记录打包、部署、更新测试中的地址

License

MIT

Copyright (c) 2018-present, 小猿大圣(Youthink)

short_url's People

Contributors

dependabot[bot] avatar imfycc avatar youthink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

short_url's Issues

请求更新

大大,请问能不能更新一下兼容redis,加个后台面板什么的支持统计次数和短链接有效时间?网上有关elixir的短链太少了,大大这个是见过的最棒的了,elixir的表现实在太优秀了!

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.