a url shortening microservice using express and redis.
- node 8 >
- docker
- yarn (optional)
- clone repo
- run
docker-compose up
to start redis. (note: redis port has been changed to6380
) - run
yarn && yarn start
(note: yarn is just a personal preference, you can use npm) - service will be running on
localhost:3000
You can also runyarn test
to run all tests
-
Data Params
url
- URL to shorten -
Success Response:
- Code: 200
Content:{ ok: true, id : 'fe14f', shortUrl : 'localhost:3000/fe14f', longUrl: 'example.com' }
- Code: 200
-
Error Response:
- Code: 400 Bad Request
Content:{ ok: false, message: 'invalid url: example' }
- Code: 400 Bad Request
-
URL Params
Required:
id=[string]
-
Success Response:
- Will redirect to long url
-
Error Response:
- Code: 400 Bad Request
Content:{ ok: false, message: 'No url found with id: example' }
- Code: 400 Bad Request