Software Alternatives & Reviews

Let's create a URL expander with Node.JS

Bitly
  1. This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.
    Const express = require('express') Const request = require('request') Const app = express() App.use(express.static('public')) App.get('/', (req, res) => { res.sendFile(__dirname + '/index.html') }) App.get('/expand', (req, res) => { let shortUrl = req.query.shortUrl // If the shortUrl doesn't start with http, add add https:// in front of it // So eg. example.com becomes https://example.com if(!shortUrl.startsWith('http')) shortUrl = 'https://' + shortUrl request({ url: shortUrl, method: "HEAD", followAllRedirects: true }, (err, response, body) => { if (err) { console.log(err) res.send("Error") } else { // Sending back the full url res.send(response.request.href) } }) }) App.listen(3000, () => { console.log('Server is running on port 3000') }).

    #Software Development #Software Development Tools #Web Development Tools 2411 social mentions

  2. 2
    Get the most out of your social and online marketing efforts. Own, understand and activate your best audience through the power of the link with Bitly Enterprise.
    There are many tools like bitly, shorturl etc. Through which we can convert our long and messy URL into a short and better looking URL. For example https://www.youtube.com/c/AngleBrace can become shorturl.at/asIW4.

    #Link Management #URL Shortener #Branded URLs 18 social mentions

Discuss: Let's create a URL expander with Node.JS

Log in or Post with