Content interpolated with bracket syntax will be evaluated for code, the output of which is included in your HTML output.
HTML Element Interpolation with Pug
Further to our previous tutorial, sometimes it may be necessary to nest HTML tags inside of each other. Element interpolation with Pug is done in a syntax similar to variable interpolation; square brackets instead of curly braces are used here.
Getting started with Pug template engine
Open and Read a file with Node.js
You can open a file for reading or writing using fs.open()
method.
Update Node Using a Package Manager
Node package manager, or npm, helps you discover, share, and use code, along with managing dependencies.
Node.js Events
Create a WordPress Post from Node.js
WordPress uses an XML-RPC interface by default. XML-RPC is a remote procedure call (RPC) protocol which uses XML to encode its calls and HTTP as a transport mechanism. With WordPress XML-RPC support, you can post to your WordPress blog using many popular clients. You could even consider writing your own client application using Node.js. Let’s do a proof of concept.
Saving Data to MongoDB Database from a Node.js Application
Random Password Generator with Node.js
Now that Node.js server is available as a template via Xen Orchestra it’s time to look at some of the cooler stuff you can do with Node.js. Here are instructions for how to build your own online Random Password Generator.
Hello World in Node.js
This is how you would script “Hello World” in Node.js
// requiring the HTTP interfaces in node var http = require('http'); // create an http server to handle requests and response http.createServer(function (req, res) { // sending a response header of 200 OK res.writeHead(200, {'Content-Type': 'text/plain'}); // print out Hello World res.end('Hello World\n'); // use port 8080 }).listen(8080); console.log('Server running on port 8080.');