Pages

Building Your First Node.js Express Server: A 'Hello World!' Tutorial

Here we will see how make a simple "Hello world!" program using node js 

Code :

#1. server.js
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);
});


Steps to see the output of Program:

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.

So, If you are having any query and doubt regarding this program then you can ask in comments. Thank You !!!
 

Securing Your WAMP Localhost: Setting the Root Password in phpMyAdmin

In this post we are going to see how to set password in phpmyadmin i.e when any user opens phpmyadmin of your local pc then phpmyadmin should ask for enter login credentials to see databases and table.

So, to configure phpmyadmin follow the steps below:

Step 1: open your phpmyadmin  http://localhost/phpmyadmin/ click on Users

phpmydmin_user

Step 2: After this you will see some users are already configured in phpmyadmin where you have to click on edit privileges link of highlighted all three users i.e. 127.0.0.1, ::1, localhost

priviledges_setting

Step 3: On each edit privileges click you will below page where you have to set same password for all three users which you want after each changes click on "Go" button

typing_password

Step 4: After password setting of these three users just try to refresh your phpmyadmin dashboard, you will get "access denied" error as given in below image.

Error #1045 – Access denied for user ‘root’@’locahost’ (using password: YES)

error_message

Step 5: By resolving this error we are ends up with our root password setting of your wampp phpmyadmin for resolving this open the "config.inc.php" file found in C:\wamp\apps\phpmyadmin4.1.x and look for /* Authentication type */ around line 28.

Set your password for the root account by entering it between the single quotes ‘ ‘ in the following line:

$cfg['Servers'][$i]['password'] = 'mypassword';

config_inc_setting
Replace mypassword with your own password which you are configured in phpmyadmin

or for other option just comment

//$cfg['Servers'][$i]['auth_type'] = 'config';
 

& uncomment 

 
$cfg['Servers'][$i]['auth_type'] = 'cookie';

Step 6: You are done with your setting for checking just open phpmyadmin in browser by following url: http://localhost/phpmyadmin/

You will see your phpmyadmin first page ask for username, password to enter in the phpmyadmin as below image

password_check
So, If you are having any query and doubt regarding this configuration then you can ask in comments.  


Thank you !!