-
I can POST a URL to
[project_url]/api/shorturl/new
and I will receive a shortened URL in the JSON response.Example:
{"original_url":"www.google.com","short_url":1}
-
An invalid URL - one that doesn't follow the valid format
http(s)://www.example.com(/more/routes)
- will generate a JSON response with an error message.Example:
{"error":"invalid URL"}
.HINT: You can use the function dns.lookup(host, cb) from the dns core module to check if the submitted url points to a valid site.
-
When I visit the shortened URL, it redirects me to the original link.
- POST [project_url]/api/shorturl/new - body (urlencoded) : url=https://www.google.com
- [this_project_url]/api/shorturl/3
On the front-end:
- Edit
public/client.js
,public/style.css
andviews/index.html
- Drag in
assets
, like images or music, to add them to your project
On the back-end: - Your app starts at
server.js
- Add frameworks and packages in
package.json
- Safely store app secrets in
.env
(nobody can see this but you and people you invite)