60 |
61 |
62 | 6. Start the Server: `$ node app.js`
63 | 7. Visit http://localhost:3000/
64 |
65 | Enjoy! :blue_heart:
66 |
--------------------------------------------------------------------------------
/views/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 18 | This service accepts a URL as a parameter and will check whether it follows the valid http://www.example.com format. 19 | If the URL is valid, it will return both the original URL and shortened URL in the JSON response. If it is not, 20 | the JSON response will contain an error instead. When you visit that shortened URL, it will redirect you to the original link. 21 |
22 | 23 |Pass the URL to path https://url-shortener-microsrvc.herokuapp.com/new/[URL] as below:
25 | 26 |https://url-shortener-microsrvc.herokuapp.com/new/https://www.github.com
28 | {
33 |
original_url: "https://www.github.com",
34 |
35 | shortened_url: "https://url-shortener-microsrvc.herokuapp.com/29183"
36 |
37 | }
38 |
39 |
40 | Visiting the shortened URL: https://url-shortener-microsrvc.herokuapp.com/29183 42 | will redirect to:https://www.github.com
43 | 44 |Enjoy! 💙
45 | 46 |