Linkpiz.com

514 Posts
Node.js URL Module

Node.js URL Module

The Built-in URL Module The URL module splits up a web address into readable parts. To include the URL module, use the require() method: var url = require('url'); Parse an address with the url.parse() method, and it will return a URL object with each part of the address as properties: Example Split a web address into readable parts: var url = require('url'); var adr = 'http://localhost:8080/default.htm?year=2017&month=february'; var q = url.parse(adr, true); console.log(q.host); //returns 'localhost:8080' console.log(q.pathname); //returns '/default.htm' console.log(q.search); //returns '?year=2017&month=february' var qdata = q.query; //returns an object: { year: 2017, month: 'february' } console.log(qdata.month); //returns 'february' Run example » Node.js…
Read More
Node.js Email

Node.js Email

The Nodemailer Module The Nodemailer module makes it easy to send emails from your computer. The Nodemailer module can be downloaded and installed using npm: C:UsersYour Name>npm install nodemailer After you have downloaded the Nodemailer module, you can include the module in any application: var nodemailer = require('nodemailer'); Send an Email Now you are ready to send emails from your server. Use the username and password from your selected email provider to send an email. This tutorial will show you how to use your Gmail account to send an email: Example var nodemailer = require('nodemailer'); var transporter = nodemailer.createTransport({ service:…
Read More
MySQL Get Started

MySQL Get Started

  Node.js can be used in database applications. One of the most popular databases is MySQL. MySQL Database To be able to experiment with the code examples, you should have MySQL installed on your computer. You can download a free MySQL database at https://www.mysql.com/downloads/. Install MySQL Driver Once you have MySQL up and running on your computer, you can access it by using Node.js. To access a MySQL database with Node.js, you need a MySQL driver. This tutorial will use the "mysql" module, downloaded from NPM. To download and install the "mysql" module, open the Command Terminal and execute the…
Read More
MySQL Create Database

MySQL Create Database

Creating a Database To create a database in MySQL, use the "CREATE DATABASE" statement: Example Create a database named "mydb": var mysql = require('mysql');var con = mysql.createConnection({ host: "localhost", user: "yourusername", password: "yourpassword" }); con.connect(function(err) { if (err) throw err; console.log("Connected!"); con.query("CREATE DATABASE mydb", function (err, result) { if (err) throw err; console.log("Database created"); }); }); Run example » Save the code above in a file called "demo_create_db.js" and run the file: Run "demo_create_db.js" C:UsersYour Name>node demo_create_db.js Which will give you this result: Connected! Database created THU HUYỀN - LINKPIZ.COM
Read More
Node.js Intro

Node.js Intro

What is Node.js? Node.js is an open source server environment Node.js is free Node.js runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.) Node.js uses JavaScript on the server Why Node.js? Node.js uses asynchronous programming! A common task for a web server can be to open a file on the server and return the content to the client. Here is how PHP or ASP handles a file request: Sends the task to the computer's file system. Waits while the file system opens and reads the file. Returns the content to the client. Ready to handle the next request.…
Read More
Node.js Get Started

Node.js Get Started

Download Node.js The official Node.js website has installation instructions for Node.js: https://nodejs.org Getting Started Once you have downloaded and installed Node.js on your computer, let's try to display "Hello World" in a web browser. Create a Node.js file named "myfirst.js", and add the following code: myfirst.js var http = require('http');http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.end('Hello World!'); }).listen(8080); Save the file on your computer: C:UsersYour Namemyfirst.js The code tells the computer to write "Hello World!" if anyone (e.g. a web browser) tries to access your computer on port 8080. For now, you do not have to understand the code.…
Read More

Node.js Events

Node.js is perfect for event-driven applications. Events in Node.js Every action on a computer is an event. Like when a connection is made or a file is opened. Objects in Node.js can fire events, like the readStream object fires events when opening and closing a file: Example var fs = require('fs'); var rs = fs.createReadStream('./demofile.txt'); rs.on('open', function () { console.log('The file is open'); }); Events Module Node.js has a built-in module, called "Events", where you can create-, fire-, and listen for- your own events. To include the built-in Events module use the require() method. In addition, all event properties and…
Read More
EWWW Image Optimizer

EWWW Image Optimizer

DOWNLOAD PLUGIN Description Are you frustrated by a slow website? Do over-sized images make you say “ewww”… Let EWWW Image Optimizer help you make your site faster, improve your bounce rate, and boost your SEO. But most importantly, make your visitors happier so they keep coming back for more. With EWWW IO you can optimize all your existing images, any plugin, and then let EWWW IO take care of new image uploads automatically. Why use EWWW Image Optimizer? No Speed Limits and file size. Smooth Handling with pixel-perfect optimization using industry-leading tools and progressive rendering. High Torque as we bring…
Read More
SVG Support

SVG Support

DOWNLOAD PLUGIN Description Safely upload SVG files to your media library and use them like any other image. Now with optional sanitization! But SVG Support has more features!!! Read on to learn more. When using SVG images on your WordPress site, it can be hard to style elements within the SVG using CSS. Now you can, easily! Scalable Vector Graphics (SVG) are becoming common place in modern web design, allowing you to embed images with small file sizes that are scalable to any visual size without loss of quality. This plugin not only provides SVG Support like the name says,…
Read More
Popup Builder by OptinMonster – WordPress Popups for Optins, Email Newsletters and Lead Generation

Popup Builder by OptinMonster – WordPress Popups for Optins, Email Newsletters and Lead Generation

DOWNLOAD PLUGIN Description The Best WordPress Popup Builder and Email Newsletter Popup Plugin is the best popup builder and marketing plugin that helps you get more email subscribers, increase sales, and grow your business. With the OptinMonster popup builder and conversion toolkit, you can turn abandoning website visitors into subscribers and customers. OptinMonster’s easy to use popup maker allows you to create beautiful popup campaigns, email subscription forms, sticky announcement bars like hello bar, gamified spin-a-wheel opt-n forms, and other types of interactive popups for your site in minutes, not hours! Your visitor’s experience is our #1 priority. OptinMonster’s campaigns…
Read More
No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.