Merge pull request #13 from shubhneet182/patch-1

Added Node.js documentation + Doc Improvements
This commit is contained in:
Randell Dawson 2020-11-02 11:55:19 -08:00 committed by GitHub
commit dc1a385bd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,10 +14,10 @@
<h2>API Project: URL Shortener Microservice</h2>
<h3>User Story: </h3>
<ol>
<li>I can POST a URL to <code>[project_url]/api/shorturl/new</code> and I will receive a shortened URL in the JSON response.<br>Example : <code>{"original_url":"www.google.com","short_url":1}</code></li>
<li>If I pass an invalid URL that doesn't follow the <code>http(s)://www.example.com(/more/routes)</code> format, the JSON response will contain an error like <code>{"error":"invalid URL"}</code><br>
HINT: to be sure that the submitted url points to a valid site you can use the function <code>dns.lookup(host, cb)</code> from the <code>dns</code> core module.</li>
<li>When I visit the shortened URL, it will redirect me to my original link.</li>
<li>I can <b>POST</b> a <b>URL</b> to <code>[project_url]/api/shorturl/new</code> and I will receive a shortened <b>URL</b> in the JSON response.<br><br><i>Example</i> : <code>{"original_url":"www.google.com","short_url":1}</code></li><br><br>
<li>If I pass an <b>invalid URL</b> that doesn't follow the <code>http(s)://www.example.com(/more/routes)</code> format, the JSON response will contain an error like <code>{"error":"invalid URL"}</code><br><br>
<b><i>HINT</i></b>: To be sure that the submitted URL points to a valid site, you can use the function <code>dns.lookup(host, cb)</code> from the <code>dns</code> core module. Incase you are new to NodeJs, you can learn about this function from its documentation.(<a href="https://nodejs.org/api/dns.html">NodeJs Documentation</a>)</li><br><br>
<li>When I visit the shortened URL, it will redirect me to my original link.</li><br>
</ol>
<h3>Short URL Creation </h3>
@ -45,4 +45,4 @@
</body>
</html>
</html>