Code Monkey home page Code Monkey logo

local-tld's Introduction

Local TLD

Build Status Dependency Status devDependency Status

Local TLD maintains a local development top level domain that you can hook various projects into.

If you know pow, this is pow without the Rack part.

Mac OS X only, for the time being. Cross platform support desired, if you can contribute it! :)

Er what?

Here’s an example. What if you maintained two web projects A and B and have a local setup of both, and you’d like to work on them both at the same time, or switch easily, and you don’t want to mess with things like http://localhost:8888 because that is just annoying and ugly.

What if you could have these two nice addresses:

http://myfancyprojectA.dev
http://thatotherprojectB.dev

Yes, you can do that by messing with /etc/hosts, but it ain’t pretty, and you have to do it for every new project and it is ugly.

Setup

$ npm -g install local-tld
  # or for now git clone $thisrepo
$ $EDITOR ~/.local-tld.json
{
  "8000": {
    "name": "myfancyprojectA"
  },
  "8001": {
    "name": "thatotherprojectB"
  }
}

Dat it. ~/.local-tld.json maps the a subdomain to a TCP port. So if you have an httpd running on localhost:8000 you can now reach it by going to http://myfancyprojectA.dev.

I want my app to register itself with local-tld!

See https://github.com/hoodiehq/local-tld-lib

Ok cool, how does it work?

This uses a cool dynamic DNS system that is built into Mac OS X. Local TLD runs a minimal DNS lookup server that does the address translation magic.

I want subdomains!

Easy. Just make your configuration look like this:

{
  "8000": {
    "name": "myfancyprojectA",
    "aliases": ["subdomain1", "subdomain2"]
  }
}

Now, you should be able to reach localhost:8000 from http://myfancyprojectA.dev, http://subdomain1.myfancyprojectA.dev, and http://subdomain2.myfancyprojectA.dev!

Sweet. Does it work with boot2docker ports?

Yep! In addition to the port, you'll need to specify your boot2docker ip address (usually 192.168.59.103) for the domains you want to map:

{
  "192.168.59.103:8002": {
    "name": "myfancyprojectC"
  }
}

(Astute readers will note that this actually means it works with any server on any IP address, not just boot2docker)

No Original Work

This is all ripped out of pow, we don’t claim any credit.

License

Apache 2 License

Copyright

(c) 2013 Jan Lehnardt [email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.