Skip to content

Commit

Permalink
[FBV][NSchool][TowerOfBabel] - Intro to babel-cli global module
Browse files Browse the repository at this point in the history
  • Loading branch information
ferborva committed May 21, 2016
1 parent 6d38c79 commit 64c22bf
Show file tree
Hide file tree
Showing 23 changed files with 94 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ Main Study Areas:

This is the link to the [Strongloop certification study guide](https://strongloop.com/node-js/certification/scnd-study-guide/#toggle-id-1). Offers a basic overview of what will be expected and has links to pages of interest.

Summaries and notes made from the general contents of this particular link can be found in the folder 'Step 1'. Link to [documents found here](https://github.com/beeva-fernandobordallo/strongloop-prep-work/tree/master/Step%201).
Summaries and notes made from the general contents of this particular link can be found in the folder 'Step 1'. Link to [documents found here](https://github.com/beeva-fernandobordallo/strongloop-prep-work/tree/master/step-1).

These will only cover the basic concepts required to get a base understanding of what node is and what makes it ... well ... NODE!!!

In later steps (and individual folders) we will cover Express, Debugging, Clusters, ...

### Step 2 - Learn Node Basics

At this point we have a basic understanding of node and are ready to dive into some hands on work. No place seems better to do this than ['The Node School'](http://nodeschool.io/). In the [Step 2 folder](https://github.com/beeva-fernandobordallo/strongloop-prep-work/tree/master/Step%202) you will find the main tutorial course solutions. Well ... my solutions.
At this point we have a basic understanding of node and are ready to dive into some hands on work. No place seems better to do this than ['The Node School'](http://nodeschool.io/). In the [Step 2 folder](https://github.com/beeva-fernandobordallo/strongloop-prep-work/tree/master/step-2) you will find the main tutorial course solutions. Well ... my solutions.

### Step 3 - The Process Global Variable

Expand Down
2 changes: 1 addition & 1 deletion Step 1/README.md → step-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ writeStream.on('error', function (err) {
});
```

Example available in [playZone folder](https://github.com/beeva-fernandobordallo/strongloop-prep-work/tree/master/Step%201/playZone) as stream-example.js.
Example available in [playZone folder](https://github.com/beeva-fernandobordallo/strongloop-prep-work/tree/master/step-1/playZone) as stream-example.js.

Can be run from console with: `node stream-example.js input.txt output.txt`

Expand Down
File renamed without changes.
File renamed without changes.
19 changes: 18 additions & 1 deletion Step 2/README.md → step-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,21 @@ First tutorial collection. Goes through the very basics:
- **Time Server**: create a TCP server that returns the current date and time in a specific format
- **HTTP File Server**: create an HTTP server which returns a specified file for every request received
- **HTTP Uppercaserer**: create an HTTP server which returns the BODY received from a POST request as an uppercase string
- **HTTP JSON API Server**: create an HTTP serve which responds to GET request to specific URLs, returning an ISO formatted date sent as a URL query parameter
- **HTTP JSON API Server**: create an HTTP serve which responds to GET request to specific URLs, returning an ISO formatted date sent as a URL query parameter


###### Tower Of Babel

Collection of tutoriales that offers an introduction to the use of ES6 in node programming:
- **Babel Setup**
- **Class**
- **Class Extend**
- **Modules with name**
- **Modules default export**
- **Block scope**
- **Computed property**
- **Iterator for of**
- **Generator**
- **Destructure**
- **Arrow Function**
- **Rest and Spread**
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
73 changes: 73 additions & 0 deletions step-2/tower-of-babel/01-babel-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
TOWER-OF-BABEL
────────────────
BABEL SETUP
Exercise 1 of 12
# Introduction
This is the first exercise to learn ES6 using babel.
Even with the power of the latest version of node.js, it isn't possible right now to use all of the features from ES6.
To enable a lot of the new grammar, there is an additional package called babel which you can install using:
$ npm install babel-cli -g
Once you have done that, two new commands become available: babel and babel-node.
Let's starting by using babel-node.
Please create a program.js file that contains:
console.log(`Hello Babel`);
Once you saved, it you will be able to run the program like this:
$ babel-node program.js
Try to run it and make sure it shows Hello Babel.
# Exercise
Create a javascript program that takes the the first command-line argument and
outputs it right after a "Hello " String using ES6 template strings.
# Hints
It is possible to pass command-line arguments to a babel program like this:
babel-node my-program.js an-argument
To access the arguments you can use the process.argv array.
Important! The process.argv array contains not just the arguments but also the runtime (first variable) and the script file loaded (second variable)!
This means the first argument is stored at the third position:
process.argv[2]
ES6 template strings are a new way to declare strings using the ``` character. In template strings you can access local variables like this:
var a = 1;
console.log(`${a}`);
Read more about template strings here: [http://updates.html5rocks.com/2015/01/ES6-Template-Strings](http://updates.html5rocks.com/2015/01/ES6-Template-Strings)
*/

'use strict';

console.log(`Hello ${process.argv[2]}`);

/*
Here's the official solution in case you want to compare notes:
────────────────────────────────────────────────────────────────────────────────
var arg = process.argv[2];
console.log(`Hello ${arg}`);
────────────────────────────────────────────────────────────────────────────────
*/

0 comments on commit 64c22bf

Please sign in to comment.