https://github.com/general-cbic/url-shortener
simple links shortener
https://github.com/general-cbic/url-shortener
Last synced: 8 months ago
JSON representation
simple links shortener
- Host: GitHub
- URL: https://github.com/general-cbic/url-shortener
- Owner: general-CbIC
- Created: 2018-09-29T09:43:33.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-29T14:19:27.000Z (about 7 years ago)
- Last Synced: 2025-02-17T04:32:43.549Z (8 months ago)
- Language: Ruby
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# URL Shortener
Simple url shortener written on ruby using [em-hiredis](https://github.com/mloughran/em-hiredis) and [sinatra](https://github.com/sinatra/sinatra).
Needs to [redis](https://redis.io) be installed.#### Run with:
```
$ bundle
$ rake
```#### Usage example:
```
$ curl --header "Content-Type: application/json" \
--request POST \
--data '{"longUrl": "https://google.com"}' \
http://localhost:1234/
```#### Answer:
```
{"url":"http://localhost:1234/1X8jx44s"}
```#### Trying link:
```
$ curl -i http://localhost:1234/1X8jx44sHTTP/1.1 301 Moved Permanently
Content-Type: text/html;charset=utf-8
Location: https://google.com
Content-Length: 0
Connection: keep-alive
Server: thin
```