Solution: Launch a custom REPL from a command


show more Solution: Launch a custom REPL from a command provides you with in-depth training on Developer. Taught by Joseph LeBlanc as part of the Node.js Essential Training (2013) show less
please wait ...

Solution: Launch a custom REPL from a command

Here's my solution to the challenge. I now have a flight repl, I can create flight objects, and they're automatically displayed in my console. I can also use the triggerArrive and triggerDepart functions. So let's take a look at how I did this. In index.js, I'm starting out with a hash bang, this command locates Node for us, so that we can run our script. Next, I require the repl module, and I also require the local flight module that we've been working with. Then, I create a prompt, based off the repl module.

Finally, I assign the flight function into the context of the prompt. Let's also take a look at package.json. I named this project flight, so that flight is the name of the command that I type. Then I also added index.js as the property for bin. When all of this was in place, I went to terminal, and I went to the path of the project. Then I used npm link to install the command. I'm going to start the command back up again. There's one pit fall that you want to avoid w...

Solution: Launch a custom REPL from a command
Video duration: 1m 19s 3h 17m Intermediate

Viewers:

Solution: Launch a custom REPL from a command provides you with in-depth training on Developer. Taught by Joseph LeBlanc as part of the Node.js Essential Training (2013)

Subject:
Developer
Software:
JavaScript Node.js
Author:
please wait ...