Enter Your Email Address to Watch This Lesson

Your link to unlock this lesson will be sent to this email address.

Unlock this lesson and all 832 of the free egghead.io lessons, plus get Node.js content delivered directly to your inbox!



Existing egghead members will not see this. Sign in.

Just one more step!

Check your inbox for an email from us and click link to unlock your lesson.



Use Now alias for custom sub-domains

2:50 Node.js lesson by

Now is a great way to deploy your node application, but the generated URLs aren't memorable or easily remembered. With Now's alias command, you can fix that. In this video lesson we'll cover how to add an alias to a deployment, giving you a custom *.now.sh subdomain, how to create an alias using your own custom domain name, how to list your aliases and finally how to remove an alias if you no longer want it.

Get the Code Now
click to level up

egghead.io comment guidelines

Avatar
egghead.io

Now is a great way to deploy your node application, but the generated URLs aren't memorable or easily remembered. With Now's alias command, you can fix that. In this video lesson we'll cover how to add an alias to a deployment, giving you a custom *.now.sh subdomain, how to create an alias using your own custom domain name, how to list your aliases and finally how to remove an alias if you no longer want it.

Here I have a simple Hello World application built with Express. I have this application deployed to Now. If I look in a browser, we can see that it's running as expected. I'd like to give my application a URL that's a little easier to read and remember. In the terminal I'm going to type in Now LS to list out my deployments. I'd like to give my most recent deployment an easier URL.

I'm going to grab the deployment ID and I'm going to type in now alias, paste that ID in, and then I'm going to give it an alias value. In this case I'm just going to throw my initials in there.

That's going to be part of the URL, so instead of this value here, where it says Now Demo-PPFC, etc., it's going to say abs.now.sh. I'm going to press Enter and we'll see the alias has been successfully added. Now I have a new URL that's much shorter and easier to remember. Back in the browser, I can update my URL to use my new alias value and everything works as expected.

It's important to note that this alias doesn't replace my original URL. I can still paste that back in here and everything will still work. Anybody that has that old link that clicks on it will still get to my site.

Let's say instead of just a now.sh subdomain, I want to point a custom domain name at my Hello World application. I can follow the same process. I can type in now alias, the ID of my deployment, and then I can pass a custom domain name.

For now, I'm just going to make one up. I'm just going to...abs.demo.org, and this doesn't exist and if it does I don't own it. But that's OK. I'm not going to break anything. I'm going to run this, and it's actually going to verify to see if my DNS settings point to Zite's DNS servers. When it finds out that they don't, it's going to give me some helpful instructions so I can fix this.

I've taken a domain name that I do own and I've pointed the name servers to Zite.world DNS servers. I'll just clear this and I'm going to run my alias command again with my ID. This time I'm going to point it to my domain name. My alias has been successfully created, so now I should be able to go to my domain name right in the browser and I'll see my application.

If you want to see what deployments you have with what aliases, you can just type in now alias LS and you'll see your alias IDs next to your deployment URL and the alias URL. If you ever want to remove an alias, you can use that ID with Now Alias RM and the ID and you can remove the alias, which we can confirm by doing another list. Now we only have the one.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?