Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
98 changes: 49 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading