The purpose of this instructional is to provide a guide for bridging the gaps and that instructional is for the purpose of bridging the gap between the developer capability and assumptions to allowing for basic introduction for the non developer. For this purpose, an open mind will be utilized for the open source nature; this is the path taken and the journey. If you want to join the White Belt and follow along with the trials along the way, this instructional will help detail the necessary path and to figure it out, with the intention of helping others with what has been learned.
The first assignment is to create a node. The node.js is a prerequisite for future tutorials. Let’s begin.
Today’s task is to create the node.js and a guide to install it. Let’s start with the link https://nodejs.org/en/
Feel free to comment along in the comment section as this instructional will be carried over into an open source project.
According to Node.js.org:
First we must download the appropriate tools for Linux (x64). Please see the home page linked above.
My options in this path seem twofold:
v4.2.4 LTS (Mature and Dependable)
v5.3.0 Stable (Latest Features)
Let’s be bold, let’s start with the latest features. I’m taking this path.
Choosing to install v5.3.0, it is necessary to install the Opening Node v5.3.0 Linux x64.tar.gz
Step 1. Save File
Step 2. Open File
Step 3. Extract
Let’s now move onto the next step in this project, the Maki tutorials, specifically the Hello World with Maki:
https://maki.io/tutorials/hello-world (Note: Before this would work, it was required to download the features of the node).
Hello World with Maki
Building an average application with Maki is incredibly simple. We’ll get a web server set up using the built-in HTTP service, and edit some content on the page to say “Hello world!”.
If you’re not an experience developer, you should first read Developer Basics and Initial Setup to get familiar with the tools we’ll be using here, including the terminal and code editors.
0. Install Maki
As with all apps, you’ll likely want to start a new folder to contain your work and install dependencies.
mkdir hello-world # creates a `hello-world` directory
cd hello-world # move into the directory we just created
npm install martindale/maki # install Maki using NPM
1. Build the App
Maki comes with a pre-configured website you can use as a starting point. To use it, we’ll need to create an instance of a Maki application. Let’s create a new file, app.js.
Now in that file, add the following contents.
var Maki = require(‘maki’); /* pulls in the Maki library */
var app = new Maki(); /* creates a new instance of Maki, and calls it “app” */
2. Create Content
Maki’s pre-configured website needs to be extended with your content. To modify the index page, we’ll simply create a new file in views/index.jade. The views/ folder doesn’t exist by default, so you might need to create it:
We’ve just created the views/ folder and placed a new index.jade file inside of it. Let’s add some content. Open views/index.jade in your editor, and add the following.
h1 Hello, world!
In the block keyword, we’ve specified that the content section should be filled out with our HTML. This uses a simple but powerful markup language known as Jade.
You’ll notice we’ve used the extends keyword to select one of Maki’s internal layouts. This is just a default, and you can override it by creating your own layout (or copying Maki’s and modifying it) in the views/ folder.
For convenience, you can even use maki.bootstrap() to automatically create the files locally for you. This is useful when you’ve got a list of Resources your application will expose!
3. Run the App
Finally, we’ll simply start the application. Since Maki has the HTTP Service enabled by default, it’ll automatically be available to your web browser.
You’ll get some output that looks like this:
[SERVICE] [HTTP] listening for [http] on http://0.0.0.0:9200
[SERVICE] [HTTP] listening for [https,spdy] on https://0.0.0.0:9563
Simply click one of those links and your browser should open and you’ll see your “Hello World” content. Congratulations, you’ve just built your first Maki app!
In the end, your directory structure should look like this:
│ └── maki
The contents of each of the files you’ve created, app.js and views/index.jade, should look like this:
var Maki = require(‘maki’);
var app = new Maki();
h1 Hello, world!
That’s it! You’re on your way to a fully-functional app.
Problem: At Step 1, Build the App, I encountered a problem.
In terminal I gave command:
I then tried the following:
dude@dude-HP ~/hello-world $ touch app.js
dude@dude-HP ~/hello-world $ var Maki = require(‘maki’)
bash: syntax error near unexpected token `(‘
dude@dude-HP ~/hello-world $ var Maki
No command ‘var’ found, but there are 22 similar ones
var: command not found
There may be some assumptions here, not sure. I did something wrong. At this stage, I was not able to continue beyond Step 1 (Build the App). What I did do was start in this tutorial before I downloaded the node, which prompted this entire instructional. For the sake of this instructional, I will start over with the commands of the tutorial but assume that to be unnecessary as I downloaded the node after the fact, that is the assumption. You know what they say about ASSUME.
Up Next: Adding Resources