how to create a new node code example
Example 1: create node project
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.status(200).send('Hello World!');
});
var port = process.env.PORT || 3000;
var server = app.listen(port, function() {
console.log('Express server listening on port ' + port);
});
open cmd run server.js
"node server.js"
log:Express server listening on port 3000
& then
open link "http://localhost:3000/" in your browser and show result.
Example 2: how to use a new node c++
struct node(){
int key;
node *next;
node(x){
key = x;
next = NULL;
}}
// after you take a input of a linked list .
// creating a new node.
node *temp = new node(key); // tem pointer pointing towards the new node.
temp -> next = head; // inserting the mew node in the start .