- node (v0.10+)
- node modules
npm command resolves all modules
$ pwd
/home/ubuntu/RHDDB7
$ npm install
$ npm test
$ pwd
/home/ubuntu/RHDDB7
$ sudo npm start
SIGINT (C-c) kills this.
This service has two functions.
- shorten
- expand (redirect)
POST to shorten
curl http://${machine-IP}/api/v1/shortenurl \
-H 'Content-Type: application/json' \
-d '{"LongUrl": "http://none.jp/"}'
sample response
{"ShortUrl":"http://${machine-IP}/rt","Created":1418455295391,"LongUrl":"http://none.jp/"}%
$ curl http://${machine-IP}/rt
<html><body>redirect to http://none.jp/
$ curl -w "%{http_code} " http://${machine-IP}/rt
<html><body>redirect to http://none.jp/308
Try on your browser.
access to http://${machine-IP}/DB