From d566fc57bb6fbb06b725c94b122d51954cc4436f Mon Sep 17 00:00:00 2001 From: coderharshit Date: Thu, 11 Oct 2018 15:48:41 +0530 Subject: [PATCH 1/3] changed the design how the shortened link and the error appears + little changes in resposivity --- app.js | 2 +- package-lock.json | 98 +++++++++---------- package.json | 2 +- views/error.ejs | 227 +++++++++++++++++++++++--------------------- views/index.ejs | 224 +++++++++++++++++++++++--------------------- views/shorten.ejs | 233 ++++++++++++++++++++++++---------------------- 6 files changed, 412 insertions(+), 374 deletions(-) diff --git a/app.js b/app.js index c132f10..7516149 100644 --- a/app.js +++ b/app.js @@ -42,7 +42,7 @@ app.post('/shorten',function(req,res){ var regex = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9]\.[^\s]{2,})/ if(!regex.test(originalUrl)) { - res.render('error',{message:'not a valid url'}) + res.render('error',{message:'Enter a valid url'}) } else { //passing the originalurl to encoder to get the shorten url; var shortenUrl=encoder(originalUrl); diff --git a/package-lock.json b/package-lock.json index 3bc5624..d92823b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", "requires": { - "mime-types": "2.1.17", + "mime-types": "~2.1.16", "negotiator": "0.6.1" } }, @@ -23,7 +23,7 @@ "resolved": "https://registry.npmjs.org/async/-/async-2.1.4.tgz", "integrity": "sha1-LSFgx3iAMuTdbL4lAvH5osj2zeQ=", "requires": { - "lodash": "4.17.4" + "lodash": "^4.14.0" } }, "bluebird": { @@ -37,15 +37,15 @@ "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", "requires": { "bytes": "3.0.0", - "content-type": "1.0.4", + "content-type": "~1.0.4", "debug": "2.6.9", - "depd": "1.1.2", - "http-errors": "1.6.2", + "depd": "~1.1.1", + "http-errors": "~1.6.2", "iconv-lite": "0.4.19", - "on-finished": "2.3.0", + "on-finished": "~2.3.0", "qs": "6.5.1", "raw-body": "2.3.2", - "type-is": "1.6.15" + "type-is": "~1.6.15" } }, "bson": { @@ -126,36 +126,36 @@ "resolved": "https://registry.npmjs.org/express/-/express-4.16.2.tgz", "integrity": "sha1-41xt/i1kt9ygpc1PIXgb4ymeB2w=", "requires": { - "accepts": "1.3.4", + "accepts": "~1.3.4", "array-flatten": "1.1.1", "body-parser": "1.18.2", "content-disposition": "0.5.2", - "content-type": "1.0.4", + "content-type": "~1.0.4", "cookie": "0.3.1", "cookie-signature": "1.0.6", "debug": "2.6.9", - "depd": "1.1.2", - "encodeurl": "1.0.2", - "escape-html": "1.0.3", - "etag": "1.8.1", + "depd": "~1.1.1", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "etag": "~1.8.1", "finalhandler": "1.1.0", "fresh": "0.5.2", "merge-descriptors": "1.0.1", - "methods": "1.1.2", - "on-finished": "2.3.0", - "parseurl": "1.3.2", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", "path-to-regexp": "0.1.7", - "proxy-addr": "2.0.2", + "proxy-addr": "~2.0.2", "qs": "6.5.1", - "range-parser": "1.2.0", + "range-parser": "~1.2.0", "safe-buffer": "5.1.1", "send": "0.16.1", "serve-static": "1.13.1", "setprototypeof": "1.1.0", - "statuses": "1.3.1", - "type-is": "1.6.15", + "statuses": "~1.3.1", + "type-is": "~1.6.15", "utils-merge": "1.0.1", - "vary": "1.1.2" + "vary": "~1.1.2" }, "dependencies": { "setprototypeof": { @@ -176,12 +176,12 @@ "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", "requires": { "debug": "2.6.9", - "encodeurl": "1.0.2", - "escape-html": "1.0.3", - "on-finished": "2.3.0", - "parseurl": "1.3.2", - "statuses": "1.3.1", - "unpipe": "1.0.0" + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.3.1", + "unpipe": "~1.0.0" }, "dependencies": { "statuses": { @@ -206,7 +206,7 @@ "resolved": "https://registry.npmjs.org/hasha/-/hasha-3.0.0.tgz", "integrity": "sha1-UqMvq4Vp1BymmmH/GiFPjrfIvTk=", "requires": { - "is-stream": "1.1.0" + "is-stream": "^1.0.1" } }, "http-errors": { @@ -217,7 +217,7 @@ "depd": "1.1.1", "inherits": "2.0.3", "setprototypeof": "1.0.3", - "statuses": "1.4.0" + "statuses": ">= 1.3.1 < 2" }, "dependencies": { "depd": { @@ -292,7 +292,7 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", "requires": { - "mime-db": "1.30.0" + "mime-db": "~1.30.0" } }, "mongodb": { @@ -308,8 +308,8 @@ "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.0.2.tgz", "integrity": "sha512-p1B0qwFQUw6C1OlFJnrOJp8KaX7MuGoogRbTaupRt0y+pPRkMllHWtE9V6i1CDtTvI3/3sy2sQwqWez7zuXEAA==", "requires": { - "bson": "1.0.4", - "require_optional": "1.0.1" + "bson": "~1.0.4", + "require_optional": "^1.0.1" } }, "mongoose": { @@ -318,7 +318,7 @@ "integrity": "sha512-y4NlLzZaQe5vJHjcEjHLKK6utjs7sVEPN971+d1vVJJGrmA+zeeFA1MEmC1J0ujD34eOSghnExXJPwCrxHHZCw==", "requires": { "async": "2.1.4", - "bson": "1.0.4", + "bson": "~1.0.4", "kareem": "2.0.3", "lodash.get": "4.4.2", "mongodb": "3.0.2", @@ -391,7 +391,7 @@ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.2.tgz", "integrity": "sha1-ZXFQT0e7mI7IGAJT+F3X4UlSvew=", "requires": { - "forwarded": "0.1.2", + "forwarded": "~0.1.2", "ipaddr.js": "1.5.2" } }, @@ -426,8 +426,8 @@ "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", "requires": { - "resolve-from": "2.0.0", - "semver": "5.5.0" + "resolve-from": "^2.0.0", + "semver": "^5.1.0" } }, "resolve-from": { @@ -451,18 +451,18 @@ "integrity": "sha512-ElCLJdJIKPk6ux/Hocwhk7NFHpI3pVm/IZOYWqUmoxcgeyM+MpxHHKhb8QmlJDX1pU6WrgaHBkVNm73Sv7uc2A==", "requires": { "debug": "2.6.9", - "depd": "1.1.2", - "destroy": "1.0.4", - "encodeurl": "1.0.2", - "escape-html": "1.0.3", - "etag": "1.8.1", + "depd": "~1.1.1", + "destroy": "~1.0.4", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "etag": "~1.8.1", "fresh": "0.5.2", - "http-errors": "1.6.2", + "http-errors": "~1.6.2", "mime": "1.4.1", "ms": "2.0.0", - "on-finished": "2.3.0", - "range-parser": "1.2.0", - "statuses": "1.3.1" + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.3.1" }, "dependencies": { "statuses": { @@ -477,9 +477,9 @@ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.1.tgz", "integrity": "sha512-hSMUZrsPa/I09VYFJwa627JJkNs0NrfL1Uzuup+GqHfToR2KcsXFymXSV90hoyw3M+msjFuQly+YzIH/q0MGlQ==", "requires": { - "encodeurl": "1.0.2", - "escape-html": "1.0.3", - "parseurl": "1.3.2", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", "send": "0.16.1" } }, @@ -504,7 +504,7 @@ "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", "requires": { "media-typer": "0.3.0", - "mime-types": "2.1.17" + "mime-types": "~2.1.15" } }, "unpipe": { diff --git a/package.json b/package.json index dc42b0f..d9360ef 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Url shortner with the help of MongoDB and Base58 decoder", "main": "app.js", "scripts": { - "start":"node app.js" + "start": "node app.js" }, "author": "Ashutosh Dwivedi", "license": "ISC", diff --git a/views/error.ejs b/views/error.ejs index 4435d5b..933ecb4 100644 --- a/views/error.ejs +++ b/views/error.ejs @@ -1,117 +1,130 @@ - - - - - - - - - - - - - - - - -
- - -
-
-

Enter the url to Sort

-
-
-
-
- - - -
-
- -
-
- -
-
-

<%= message %>

-
-
-
- + + + + + + + + + + + + + + +
+ +
+
+

Enter the url to Short

+
+
+
+
+ + +
-
-
- -
-
-
-
-
Url Shortener
-

You can Short your long url with the help of this Url Shortner.

-

Please share it in your friend circle

- -
-

© 2017-18, All Rights Reserved www.ashutoshdwivedi.in

-
-
-

Developed by Ashutosh

-
Meet me here
- -
-
-
- -
+
+
+ +
+
+ <%= message %> +
+
+ +
+
+ +
+
+
+
+
Url Shortener
+

You can Short your long url with the help of this Url Shortner.

+

Please share it in your friend circle

+ +
+

© 2017-18, All Rights Reserved www.ashutoshdwivedi.in

+
+
+

Developed by Ashutosh

+
Meet me here
+ +
+
+
+ +
+ + +
diff --git a/views/index.ejs b/views/index.ejs index 117dece..bfff732 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -1,114 +1,130 @@ - - - - - - - - - - - - - - - - -
- - -
-
-

Enter the url to Sort

-
-
-
-
- - - -
-
- -
-
- -
- -
-
+ + + + + + + + + + + + + + +
+ +
+
+

Enter the url to Short

+
+
+
+
+ + + +
+
+
+
+ +
+
+ +
-
- -
-
-
-
-
Url Shortener
-

You can Short your long url with the help of this Url Shortner.

-

Please share it in your friend circle

-
-

© 2017-18, All Rights Reserved www.ashutoshdwivedi.in

-
-
-

Developed by Ashutosh

-
Meet me here
- -
-
-
- -
+
-
+ +
+
+
+
+
Url Shortener
+

You can Short your long url with the help of this Url Shortner.

+

Please share it in your friend circle

+ +
+

© 2017-18, All Rights Reserved www.ashutoshdwivedi.in

+
+
+

Developed by Ashutosh

+
Meet me here
+ +
+
+
+ +
+ + +
+ diff --git a/views/shorten.ejs b/views/shorten.ejs index 094b7fe..9bffd3a 100644 --- a/views/shorten.ejs +++ b/views/shorten.ejs @@ -1,123 +1,132 @@ - - - - - - - - - - - - - - - - -
- - -
-
-

Enter the url to Sort

-
-
-
-
- - - -
-
- -
-
- -
-
-
- + + + + + + + + + + + + + + +
+ +
+
+

Enter the url to Short

+
+
+
+
+ + + +
+
+
+
+ +
+
+
-
-
- -
-
-
-
-
Url Shortener
-

You can Short your long url with the help of this Url Shortner.

-

Please share it in your friend circle

- -
-

© 2017-18, All Rights Reserved www.ashutoshdwivedi.in

-
-
-

Developed by Ashutosh

-
Meet me here
- -
-
-
- -
+
+
+ +
+
+
+
+
Url Shortener
+

You can Short your long url with the help of this Url Shortner.

+

Please share it in your friend circle

+ +
+

© 2017-18, All Rights Reserved www.ashutoshdwivedi.in

+
+
+

Developed by Ashutosh

+
Meet me here
+ +
+
+
+ +
+ + +
+ + From b0624875ab56ae3ff3cd718a9592ca192f8842bf Mon Sep 17 00:00:00 2001 From: coderharshit Date: Thu, 11 Oct 2018 15:53:29 +0530 Subject: [PATCH 2/3] a little change on how link appears in hover --- views/error.ejs | 4 ++++ views/index.ejs | 4 ++++ views/shorten.ejs | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/views/error.ejs b/views/error.ejs index 933ecb4..dbc7a54 100644 --- a/views/error.ejs +++ b/views/error.ejs @@ -6,6 +6,10 @@