I have installed node js on my cent os server, it is working fine. I have developed a node js app on my local machine, it works fine.
However, I cannot seem to find any documentation about:
I found some tutorials that refer to something called 'express'. But this seems to be for building your app on the linux server.
Where do I upload my app in the node js install and, once uploaded, how do I start it?
You don't need to upload your Node.js application anywhere - just open a cmd shell and run the command node yourapp.js
:
node
- opens the node.exe which is located at C:\Program Files (x86)\nodejs\node.js
by default.
yourapp.js
- the path of the javascript file that contains the code to run.
Express is a very useful node.js framework. It has nothing to do with linux specifically - it works on every operation system:
Express is a minimal and flexible node.js web application framework, providing a robust set of features for building single and multi-page, and hybrid web applications.
Here is a sample of how to create a simple express application:
// This is how you create express application by including the 'express' module.
var express = require('express');
var app = express();
// Respond to GET requests to 'http://localhost:3000/' returning 'hello world'.
app.get('/', function(req, res){ res.send('hello world'); });
app.listen(3000);