You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Before we start, there are some required prerequisites. You need to have Node 8.x and npm 5.2 or greater installed. npm comes with the official node distribution, so if you install Node from Nodejs.org, you should be good.</p>
9
-
<p>You’ll also need access to an OpenShift environment or the Red Hat Container Development Kit (CDK) minishift environment. For this example, I’ll be using minishift (instructions on getting minishift up and running).</p>
10
-
<p>For my local minishift, I start it with this command:</p>
<p>You also need to be logged in to whatever OpenShift cluster you are using (OpenShift or minishift) using <code>oc Login</code></p>
8
+
<p>This guide we will show how easy it is to deploy an <ahref="https://expressjs.com/" target="_blank">Express.js Application</a> to Openshift in just a couple steps using the Nodeshift CLI</p>
9
+
10
+
<p>To run the Node.js example, this guide assumes that you have a recent version of Node.js installed. Long Term Support(LTS) and Current Versions can be downloaded from the official <ahref="https://nodejs.org" target="_blank">Node.js Organization Site</a>. These downloads also comes with current versions of npm, which is the package manager for Node.js</p>
11
+
12
+
<p>This guide also mentions a cli tool called <code>npx</code>, this also comes standard with recent versions of npm. To learn more about these tools, see the links in the appendix section at the end of this guide.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec lobortis turpis. Suspendisse sed quam est. Sed quis mi volutpat, consectetur urna non, commodo quam. Nunc vel est varius, porta justo vel, congue erat. Maecenas interdum sollicitudin ultrices. Nullam fermentum nec dui ac commodo</p>
24
+
<h2>Generate an Express.js App</h2>
25
+
<p>Generating a new Express.js application can be done fairly easily with the <ahref="https://expressjs.com/en/starter/generator.html" target="_blank">Express.js Generator</a>. Using the npx command, the generator doesn't even need to be installed, but can be run like this:</p>
26
26
<code>$ npx express-generator .</code>
27
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec lobortis turpis. Suspendisse sed quam est. Sed quis mi volutpat, consectetur urna non, commodo quam. Nunc vel est varius, porta justo vel, congue erat. Maecenas interdum sollicitudin ultrices. Nullam fermentum nec dui ac commodo</p>
27
+
<p>This will generate a basic Express.js application in the current directory. If you want to see the application in action locally, be sure to run <code>npm install</code> and then <code>npm run start</code>. In the next step we will be deploying this to an Openshift instance, so running locally is not necessary.</p>
<p>With the application generated, it can now be deployed to an Openshift Cluster* with only one other command using the Nodeshift CLI tool. Again, npx is used so nothing needs to be installed globally</p>
<p>While the nodeshift cli has other commands, ttarget="_blankhe default command is to perform an <ahref="https://github.com/openshift/source-to-image#overview" target="_blank"> s2i deployment</a>. The deploy port is specificed since by default, express will start applications on port 3000 and the expose flag is used to create a Route, so the application is accessible outside the Openshift Cluster</p>
43
+
44
+
<p>* This guide assumes access to an Openshift Cluster, see the appendix section below for links on getting access to an Openshift Cluster</p>
28
45
</div>
29
46
</div>
30
47
</div>
@@ -36,10 +53,34 @@ <h2>Generate an Express App</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec lobortis turpis. Suspendisse sed quam est. Sed quis mi volutpat, consectetur urna non, commodo quam. Nunc vel est varius, porta justo vel, congue erat. Maecenas interdum sollicitudin ultrices. Nullam fermentum nec dui ac commodo</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec lobortis turpis. Suspendisse sed quam est. Sed quis mi volutpat, consectetur urna non, commodo quam. Nunc vel est varius, porta justo vel, congue erat. Maecenas interdum sollicitudin ultrices. Nullam fermentum nec dui ac commodo</p>
56
+
<h2>Access your application</h2>
57
+
<p>Once the application deployed, there are a couple of ways to interact with it.</p>
58
+
<p>
59
+
1. Using Openshift Developer Topology view, it is easy to see our running Application pod. This might looks something like this:
60
+
</p>
61
+
<p>
62
+
<imgsrc="../assets/images/getting_started/express-generator-1.png" alt="Openshift Web Console showing a running pod">
63
+
</p>
64
+
<p>
65
+
Clicking on the top right icon of the circle(this is the running application inside a Kubernetes Pod) will then open up the "Welcome To Express" Web Page, which will look like this:
66
+
</p>
67
+
<p>
68
+
<imgsrc="../assets/images/getting_started/express-web-page.png" alt="Welcome to Express">
69
+
</p>
70
+
71
+
<p>
72
+
2. Another, less UI friendly way, is to use <code>curl</code> to access the applications Route which might look like this:
<p>Before we start, there are some required prerequisites. You need to have Node 8.x and npm 5.2 or greater installed. npm comes with the official node distribution, so if you install Node from Nodejs.org, you should be good.</p>
56
-
<p>You’ll also need access to an OpenShift environment or the Red Hat Container Development Kit (CDK) minishift environment. For this example, I’ll be using minishift (instructions on getting minishift up and running).</p>
57
-
<p>For my local minishift, I start it with this command:</p>
<p>You also need to be logged in to whatever OpenShift cluster you are using (OpenShift or minishift) using <code>oc Login</code></p>
95
+
<h2>Extra Resources</h2>
96
+
<p>
97
+
<h3>Openshift</h3>
98
+
<p>If you do not already have access to an Openshift Cluster, you can start a local copy by using <ahref="https://developers.redhat.com/products/codeready-containers/overview" target="_blank" >Code Ready Containers.</a>. Note that you will need to create a Red Hat Developers login to download.</p>
99
+
</p>
100
+
101
+
<p>
102
+
<h3>Node.js</h3>
103
+
<p>
104
+
Node.js is an open-source, cross-platform, JavaScript runtime environment. It executes JavaScript code outside of a browser. For more information on using Node.js, <ahref="https://nodejs.org" target="_blank">see the Node.js Website</a>.
105
+
</p>
106
+
</p>
107
+
108
+
<p>
109
+
<h3>npm</h3>
110
+
<p>npm is the world’s largest software registry. Open source developers from every continent use npm to share and borrow packages, and many organizations use npm to manage private development as well. npm's <ahref="https://www.npmjs.com/" target="_blank">website is here</a></p>
111
+
</p>
112
+
113
+
<p>
114
+
<h3>npx</h3>
115
+
<p>npx is a tool intended to help round out the experience of using packages from the npm registry — the same way npm makes it super easy to install and manage dependencies hosted on the registry, npx makes it easy to use CLI tools and other executables hosted on the registry. npx is included with npm and is installed with the basic Node.js installer</p>
0 commit comments