The longest snake in the world is the reticulated python, however, did you know that there are others of very similar size? Weighing at 100 kg, the green anaconda is one of the heaviest, the Burmes...
0
0
0
0
0
0
Post is under moderation
Stream item published successfully. Item will now be visible on your stream.
NTP Network Time Protocol
DescriptionThe Network Time Protocol is a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks. In operation since before 1985, NTP is one of the oldest Internet protocols in current use. NTP was designed by David L. Mills of the University of Delaware
0
0
0
0
0
0
Post is under moderation
Stream item published successfully. Item will now be visible on your stream.
It could be devastating to your privacy to just throw away an old computer and hope that no one would try to access your information.
Degaussing a hard drive and shredding one accomplish the goal of destroying information, but they do it in different ways.
The Importance of Hard Drive Destruction
Everything you have ever done on your computer is accessible through your hard drive. That means emails you have sent, pictures you have saved, and accounts that you have signed into over the years. Although it doesn’t mean that someone will take your information, it’s better to be safe than sorry.
Hard Drive Degaussing
Hard drive degaussing erases all of your information using a magnetic field but leaves small amounts of data behind. However, hard drive shredding completely destroys the drive and is considerably less expensive.
Hard Drive Shredding
When it comes to hard drive shredding, all of the information that is saved onto your hard drive is physically destroyed.
Your old hard drive will be torn apart completely, piece by piece, ensuring that nothing is still accessible. You should find a company to help you with your hard drive shredding to protect yourself from injury.
Whether you choose hard drive degaussing or hard drive shredding, you are taking precautions to help secure your information and that is extremely important. You should look for the most cost-effective solution for your job.
Shred Nations Is Your Solution For Hard Drive Destruction
For free quotes on local hard drive shredding service providers, fill out the form on your right, or give us a call at (800) 747-3365 to get free hard drive destruction quotes from providers near your home or business.
Internet Protocol Version 6 (IPv6) is a network layer protocol that enables data communications over a packet switched network. Packet switching involves the sending and receiving of data in packets between two nodes in a network. The working standard for the IPv6 protocol was published by the Internet Engineering Task Force (IETF) in 1998. The IETF specification for IPv6 is RFC 2460. IPv6 was intended to replace the widely used Internet Protocol Version 4 (IPv4) that is considered the backbone of the modern Internet. IPv6 is often referred to as the "next generation Internet" because of its expanded capabilities and its growth through recent large scale deployments. In 2004, Japan and Korea were acknowledged as having the first public deployments of IPv6.
The explosive growth in mobile devices including mobile phones, notebook computers, and wireless handheld devices has created a need for additional blocks of IP addresses. IPv4 currently supports a maximum of approximately 4.3 billion unique IP addresses. IPv6 supports a theoretical maximum of 2128 addresses (340,282,366,920,938,463,463,374,607,431,768,211,456 to be exact!). Recent advancements in network technology including Network Address Translation (NAT) have temporarily lessened the urgency for new IP addresses, however, recent estimates indicate that IPv4 addresses could be exhausted as soon as 2012.
IPv6 and IPv4 share a similar architecture. The majority of transport layer protocols that function with IPv4 will also function with the IPv6 protocol. Most application layer protocols are expected to be interoperable with IPv6 as well, with the notable exception of File Transfer Protocol (FTP). FTP uses embedded network layer addresses to facilitate data transmission. An IPv6 address consists of eight groups of four hexadecimal digits. If a group consists of four zeros, the notation can be shortened using a colon to replace the zeros.
A main advantage of IPv6 is increased address space. The 128-bit length of IPv6 addresses is a significant gain over the 32-bit length of IPv4 addresses, allowing for an almost limitless number of unique IP addresses. The size of the IPv6 address space makes it less vulnerable to malicious activities such as IP scanning. IPv6 packets can support a larger payload than IPv4 packets resulting in increased throughput and transport efficiency.
A key enhancement over IPv4 is native support for mobile devices. IPv6 supports the Mobile IPv6 (MIPv6) protocol which enables mobile devices to switch between networks and receive a roaming notification regardless of physical location. MIPv6 is a hallmark of the protocol and was specified as a firm requirement during the design of IPv6. The IETF has separate specifications for MIPv6 that detail data structure, messaging, and security requirements.
Auto-configuration is another IPv6 enhancement that is considered a great benefit to network administrators. IPv6 devices can independently auto-configure themselves when connected with other IPv6 devices. Configuration tasks that can be carried out automatically include IP address assignment and device numbering. An IPv6 router has the ability to determine its own IPv6 address using data link layer addressing parameters. The IETF has issued RFC 2462 to set guidelines for IPv6 auto-configuration.
The IPv6 protocol improves upon IPv4 with increased authentication and privacy measures. IPSec security is embedded into the IPv6 specification to manage encryption and authentication between hosts. This built in security framework enables secure data traffic between hosts that is independent of any applications on either host. In this way, IPv6 provides an efficient end to end security framework for data transfer at the host or the network level.
The deployment of IPv6 networks is growing worldwide. Full replacement of IPv4 is expected to take some time, as it remains the most widely used Internet Protocol. The United States, China, and India are leading recent deployments of the IPv6 protocol and have large investments in IPv6 network infrastructure. The United States government has mandated that federal agencies must complete the transition to an IPv6 infrastructure no later than 2008. Software companies are also releasing operating systems that support the IPv6 standard. In 1997, IBM became the first commercial vendor to support IPv6 through its AIX 4.3 operating system. The latest version of Microsoft's Windows operating system, Windows Vista, has full IPv6 support enabled by default.
Internet Protocol Version 6 (IPv6) is a network layer protocol that enables data communications over a packet switched network. Packet switching involves the sending and receiving of data in packets between two nodes in a network. The working standard for the IPv6 protocol was published by the Internet Engineering Task Force (IETF) in 1998. The IETF specification for IPv6 is RFC 2460. IPv6 was intended to replace the widely used Internet Protocol Version 4 (IPv4) that is considered the backbone of the modern Internet. IPv6 is often referred to as the "next generation Internet" because of its expanded capabilities and its growth through recent large scale deployments. In 2004, Japan and Korea were acknowledged as having the first public deployments of IPv6.
The explosive growth in mobile devices including mobile phones, notebook computers, and wireless handheld devices has created a need for additional blocks of IP addresses. IPv4 currently supports a maximum of approximately 4.3 billion unique IP addresses. IPv6 supports a theoretical maximum of 2128 addresses (340,282,366,920,938,463,463,374,607,431,768,211,456 to be exact!). Recent advancements in network technology including Network Address Translation (NAT) have temporarily lessened the urgency for new IP addresses, however, recent estimates indicate that IPv4 addresses could be exhausted as soon as 2012.
IPv6 and IPv4 share a similar architecture. The majority of transport layer protocols that function with IPv4 will also function with the IPv6 protocol. Most application layer protocols are expected to be interoperable with IPv6 as well, with the notable exception of File Transfer Protocol (FTP). FTP uses embedded network layer addresses to facilitate data transmission. An IPv6 address consists of eight groups of four hexadecimal digits. If a group consists of four zeros, the notation can be shortened using a colon to replace the zeros.
A main advantage of IPv6 is increased address space. The 128-bit length of IPv6 addresses is a significant gain over the 32-bit length of IPv4 addresses, allowing for an almost limitless number of unique IP addresses. The size of the IPv6 address space makes it less vulnerable to malicious activities such as IP scanning. IPv6 packets can support a larger payload than IPv4 packets resulting in increased throughput and transport efficiency.
A key enhancement over IPv4 is native support for mobile devices. IPv6 supports the Mobile IPv6 (MIPv6) protocol which enables mobile devices to switch between networks and receive a roaming notification regardless of physical location. MIPv6 is a hallmark of the protocol and was specified as a firm requirement during the design of IPv6. The IETF has separate specifications for MIPv6 that detail data structure, messaging, and security requirements.
Auto-configuration is another IPv6 enhancement that is considered a great benefit to network administrators. IPv6 devices can independently auto-configure themselves when connected with other IPv6 devices. Configuration tasks that can be carried out automatically include IP address assignment and device numbering. An IPv6 router has the ability to determine its own IPv6 address using data link layer addressing parameters. The IETF has issued RFC 2462 to set guidelines for IPv6 auto-configuration.
The IPv6 protocol improves upon IPv4 with increased authentication and privacy measures. IPSec security is embedded into the IPv6 specification to manage encryption and authentication between hosts. This built in security framework enables secure data traffic between hosts that is independent of any applications on either host. In this way, IPv6 provides an efficient end to end security framework for data transfer at the host or the network level.
The deployment of IPv6 networks is growing worldwide. Full replacement of IPv4 is expected to take some time, as it remains the most widely used Internet Protocol. The United States, China, and India are leading recent deployments of the IPv6 protocol and have large investments in IPv6 network infrastructure. The United States government has mandated that federal agencies must complete the transition to an IPv6 infrastructure no later than 2008. Software companies are also releasing operating systems that support the IPv6 standard. In 1997, IBM became the first commercial vendor to support IPv6 through its AIX 4.3 operating system. The latest version of Microsoft's Windows operating system, Windows Vista, has full IPv6 support enabled by default.
I am sure all of you project management enthusiasts must have wondered sometimes as to what exactly is difference between PMP, PRINCE2 and Scrum/Agile? Well look no further as in this article I am going to do exactly that i.e. clarify the difference between these three.
Please note I am not going to compare the certification detail, exam fee, exam type/questions and books/resources e.t.c. because you will find plenty of information about it on internet. Instead I am going to go straight into the heart of difference. So here you go!
PMP is a standard, PRINCE2 is a methodology and Scrum/Agile is a framework.
Loosely speaking you can use these terms, standard, methodology and framework interchangeably for PMP, PRINCE2 and Scrum/Agile but here I am talking in strict technical sense.
PMP In simple terms PMP is a “standard”. Standard means best practices. They are neither legally binding nor you are forced to adopt them. It simply means that based on experiences from all over the world, a standard has been made which if you apply in your situation, will bring favourable results. But it doesn’t mean there is 100% guarantee that they will always bring favourable results to you. If you open the first page of PMBOK (the page after trademarks and logos) which has title “Notice”, you will see it states exactly that. Here are some excerpts from that page.
The Project Management Institute, Inc. (PMI) standards and guidelines publications, of which the document contained herein is one, are developed through a voluntary consensus standards development process.
PMI does not undertake to guarantee the performance of any individual manufacturer or seller’s products or services by virtue of this standard or guide.
PMI has no power, nor does it undertake to police or enforce compliance with the contents of this document.
PRINCE2 As I stated Prince2 is a methodology. Methodology means doing something step by step. This is what Prince2 essentially about i.e. it lists down steps to perform to do project management unlike PMP. It tells you what to do first, then second and so on. Although you may see that PMP has also got steps but essentially they are not and neither they are performed in particular order in strict sense. Here is a quote from Wikipedia.
PRINCE2 is a process-driven project management method which contrasts with reactive/adaptive methods such as Scrum.
PRINCE2 closely resemble PMP but not Scrum/Agile.
Scrum/Agile Scrum/Agile is a framework. Framework means a base on which you can build something. That’s why you will see that based on Scrum framework there are numerous certifications being offered. One of them is offered by PMI which is called PMI-ACP (Agile Certified Practitioner). And then there are some others too such as Scrum Alliance and Scrum Council. Framework provides you with boundary or blue print of what is included in it and then you can extend on it. All of these certifications above have their own course outline and structure even though they are based on same framework.
It can be said that project management itself is a framework on which all these certifications, PMP, PRINCE2 and Scrum/Agile are based.
Cross-Frame Scripting is a web attack technique that exploits specific browser bugs to eavesdrop on the user through JavaScript. This type of attack requires social engineering and completely depends on the browser selected by the user, therefore it is perceived as a minor web application security threat.
Conditions of a Cross-Frame Scripting Attack
The goal of an XFS attack is to steal user credentials for a certain website or web application. For this to happen, all the following conditions must be met:
The website or web application must be vulnerable to XFS attacks and must control valuable user input (login data or other sensitive information).
The attacker must place malicious JavaScript code on a web page that they control.
The attacker must use social engineering (e.g. a phishing attack) to trick the victim to visit the web page that the attacker controls.
The victim must use a vulnerable browser version (for example, IE6 on Windows XP)
It is very unlikely that all these conditions are met at the same time, especially since only old browser versions are vulnerable to such attacks. Therefore, an XFS attack is rather unlikely or must be specifically targetted, for example, at an organization that still uses old browsers and operating systems.
Anatomy of an XFS Attack
In a typical XFS attack, once the browser user visits the web page controlled by the attacker, the following happens:
The legitimate page (usually a login page) is opened in an HTML IFRAME element.
The IFRAME element is maximized to fill the entire page and the frame’s borders are removed so that the unsuspecting user thinks that they are visiting the legitimate site.
When the victim attempts to log in to the legitimate website or web application, malicious JavaScript outside the IFRAME captures keyboard events (keystrokes) and sends them to the attacker.
In most browsers, this is not possible due to the Same-Origin Policy. This policy, which is standard in all modern browsers, prevents sharing of information via JavaScript between sites with different origins. Since the attacker-controlled page and the legitimate website or web application have different origins (different servers), it should not be possible for JavaScript on the attacker’s server to have access to key events from the IFRAME element that contains the third-party page.
Cross-Frame Scripting (XFS) vs. Cross-Site Scripting (XSS)
Despite the similarity in the name, Cross-Frame Scripting has nothing to do with Cross-Site Scripting, however, the two may be used together. XSS vulnerabilities and related XSS attacks happen because of vulnerable input processing on a vulnerable page while XFS attacks are mostly due to browsers not implementing Same-Origin Policy or implementing it with errors. Therefore, web application developers are not to blame for XFS vulnerabilities.
Cross-Frame Scripting is however very closely related to clickjacking. There is so much similarity that the methods used to protect your website or web application against clickjacking are, in most cases, also applicable for XFS protection.
How to Protect Your Web Application Against XFS
Since Cross-Frame Scripting vulnerabilities appear in web browsers, web application developers can only prevent frame embedding. There are three primary methods of protection. Since all of them are also used to protect against clickjacking, you can read all about them in our article How to Defend Against Clickjacking Attacks:
Framebusting: The legitimate website owner only needs to modify the web page HTML code.
The Content-Security-Policy: frame-ancestors header: The legitimate website owner must modify web server configuration and have this header automatically included with every page.
The X-Frame-Options header: The legitimate website owner must modify web server configuration and have this header automatically included with every page.
Write powerful, clean and maintainable JavaScript with clear, practical lessons in application architecture, package management, tools, shorthands, callbacks, classes, flow control and much more.
There’s no doubt that the JavaScript ecosystem changes fast. Not only are new tools and frameworks introduced and developed at a rapid rate, the language itself has undergone big changes with the introduction of ES2015 (aka ES6). Understandably, many articles have been written complaining about how difficult it is to learn modern JavaScript development these days.
In this article, I’ll introduce you to modern JavaScript. We’ll take a look at recent developments in the language and get an overview of the tools and techniques currently used to write front-end web applications. If you’re just starting out with learning the language, or you’ve not touched it for a few years and are wondering what happened to the JavaScript you used to know, this article is for you.
A Note About Node.js
Node.js is a runtime that allows server-side programs to be written in JavaScript. It’s possible to have full-stack JavaScript applications, where both the front and back end of the app is written in the same language. Although this article is focused on client-side development, Node.js still plays an important role.
The arrival of Node.js had a significant impact on the JavaScript ecosystem, introducing the npm package manager and popularizing the CommonJS module format. Developers started to build more innovative tools and develop new approaches to blur the line between the browser, the server, and native applications.
JavaScript ES2015+
In 2015, the sixth version ofECMAScript— the specification that defines the JavaScript language — was released under the name ofES2015(still often referred to as ES6). This new version included substantial additions to the language, making it easier and more feasible to build ambitious web applications. But improvements don’t stop with ES2015; each year, a new version is released.
Declaring variables
JavaScript now has two additional ways to declare variables:let and const.
let is the successor to var . Although var is still available, let limits the scope of variables to the block (rather than the function) they’re declared within, which reduces the room for error:
// ES5
for(var i =1; i <5; i++){
console.log(i);
}
// <-- logs the numbers 1 to 4
console.log(i);
// <-- 5 (variable i still exists outside the loop)
// ES2015
for(let j =1; j <5; j++){
console.log(j);
}
console.log(j);
// <-- 'Uncaught ReferenceError: j is not defined'
Using const allows you to define variables that cannot be rebound to new values. For primitive values such as strings and numbers, this results in something similar to a constant, as you cannot change the value once it has been declared:
const name ='Bill';
name ='Steve';
// <-- 'Uncaught TypeError: Assignment to constant variable.'
// Gotcha
const person =;
person.name ='Steve';
// person.name is now Steve.
// As we're not changing the object that person is bound to, JavaScript doesn't
// complain.
Arrow functions
Arrow functionsprovide a cleaner syntax for declaring anonymous functions (lambdas), dropping the function keyword and the return keyword when the body function only has one expression. This can allow you to write functional style code in a nicer way:
// ES5
varadd=function(a, b){
return a + b;
}
// ES2015
constadd=(a, b)=> a + b;
The other important feature of arrow functions is that they inherit the value of this from the context in which they are defined:
functionPerson(){
this.age =0;
// ES5
setInterval(function(){
this.age++;// |this| refers to the global object
},1000);
// ES2015
setInterval(()=>{
this.age++;// |this| properly refers to the person object
},1000);
}
var p =newPerson();
Improved Class syntax
If you’re a fan of object-oriented programming, you might like theaddition of classes to the languageon top of the existent mechanism based on prototypes. While it’s mostly just syntactic sugar, it provides a cleaner syntax for developers trying to emulate classical object-orientation with prototypes.
classPerson{
constructor(name){
this.name = name;
}
greet(){
console.log(`Hello, my name is $`);
}
}
Promises / Async functions
The asynchronous nature of JavaScript has long represented a challenge; any non-trivial application ran the risk of falling into a callback hell when dealing with things like Ajax requests.
Fortunately, ES2015 added native support forpromises. Promises represent values that don’t exist at the moment of the computation but that may be available later, making the management of asynchronous function calls more manageable without getting into deeply nested callbacks.
ES2017 introducedasync functions(sometimes referred to as async/await) that make improvements in this area, allowing you to treat asynchronous code as if it were synchronous:
asyncfunctiondoAsyncOp(){
var val =awaitasynchronousOperation();
console.log(val);
return val;
};
Modules
Another prominent feature added in ES2015 is a native module format, making the definition and usage of modules a part of the language. Loading modules was previously only available in the form of third-party libraries. We’ll look at modules in more depth in the next section.
There are other features we won’t talk about here, but we’ve covered at some of the major differences you’re likely to notice when looking at modern JavaScript. You can check a complete list with examples on theLearn ES2015page on theBabel site, which you might find useful to get up to date with the language. Some of those features include template strings, block-scoped variables and constants, iterators, generators, new data structures such as Map and Set, and more.
Code linting
Linters are tools that parse your code and compare it against a set of rules, checking for syntax errors, formatting, and good practices. Although the use of a linter is recommended to everyone, it’s especially useful if you’re getting started. When configured correctly for your code editor/IDE, you can get instant feedback to ensure you don’t get stuck with syntax errors as you’re learning new language features.
You cancheck out ESLint, which is one of the most popular and supports ES2015+.
Modular Code
Modern web applications can have thousands (even hundred of thousands) of lines of code. Working at that size becomes almost impossible without a mechanism to organize everything in smaller components, writing specialized and isolated pieces of code that can be reused as necessary in a controlled way. This is the job of modules.
CommonJS modules
A handful of module formats have emerged over the years, the most popular of which isCommonJS. It’s the default module format in Node.js, and can be used in client-side code with the help of module bundlers, which we’ll talk about shortly.
It makes use of a module object to export functionality from a JavaScript file and a require() function to import that functionality where you need it.
// lib/math.js
functionsum(x, y){
return x + y;
}
const pi =3.141593
module.exports ={
sum: sum,
pi: pi
};
// app.js
const math =require("lib/math");
console.log("2π = "+ math.sum(math.pi, math.pi));
ES2015 modules
ES2015 introduces a way to define and consume components right into the language, which was previously possible only with third-party libraries. You can have separate files with the functionality you want, and export just certain parts to make them available to your application.
Native Browser Support
At the time of writing, native browser support for ES2015 modules is still under development, so you currently need some additional tools to be able to use them.
Here’s an example:
// lib/math.js
exportfunctionsum(x, y){
return x + y;
}
exportconst pi =3.141593;
Here we have a module thatexportsa function and a variable. We can include that file in another one and use those exported functions:
// app.js
import*as math from"lib/math";
console.log("2π = "+ math.sum(math.pi, math.pi));
Or we can also be specific and import only what we need:
Other languages have long had their own package repositories and managers to make it easier to find and install third-party libraries and components. Node.js comes with its own package manager and repository,npm. Although there are other package managers available, npm has become the de facto JavaScript package manager and is said to be the largest package registry in the world.
In thenpm repositoryyou can find third-party modules that you can easily download and use in your projects with a single npm install <package> command. The packages are downloaded into a local node_modules directory, which contains all the packages and their dependencies.
The packages that you download can be registered as dependencies of your project in apackage.jsonfile, along with information about your project or module (which can itself be published as a package on npm).
You can define separate dependencies for both development and production. While the production dependencies are needed for the package to work, the development dependencies are only necessary for the developers of the package.
Example package.json file
{
"name":"demo",
"version":"1.0.0",
"description":"Demo package.json",
"main":"main.js",
"dependencies":{
"mkdirp":"^0.5.1",
"underscore":"^1.8.3"
},
"devDependencies":,
"scripts":{
"test":"echo \"Error: no test specified\" && exit 1"
},
"author":"Sitepoint",
"license":"ISC"
}
Build Tools
The code that we write when developing modern JavaScript web applications almost never is the same code that will go to production. We write code in a modern version of JavaScript that may not be supported by the browser, we make heavy use of third-party packages that are in a node_modules folder along with their own dependencies, we can have processes like static analysis tools or minifiers, etc. Build tooling exists to help transform all this into something that can be deployed efficiently and that’s understood by most web browsers.
Module bundling
When writing clean, reusable code with ES2015/CommonJS modules, we need some way to load these modules (at least until browsers support ES2015 module loading natively). Including a bunch of script tags in your HTML isn’t really a viable option, as it would quickly become unwieldy for any serious application, and all those separate HTTP requests would hurt performance.
We can include all the modules where we need them using the import statement from ES2015 (or require , for CommonJS) and use a module bundler to combine everything together into one or more files (bundles). It’s this bundled file that we’re going to upload to our server and include in our HTML. It will include all your imported modules and their necessary dependencies.
There are currently a couple of popular options for this, the most popular ones beingWebpack,BrowserifyandRollup.js. You can choose one or another depending on your needs.
In order to make our modern JavaScript work, we need to translate the code we write to its equivalent in an earlier version (usually ES5). The standard tool for this task isBabel— a compiler that translates your code into compatible code for most browsers. In this way, you don’t have to wait for vendors to implement everything; you can just use all the modern JS features.
There are a couple of features that need more than a syntax translation. Babel includes aPolyfillthat emulates some of the machinery required for some complex features such as promises.
Build systems & task runners
Module bundling and transpilation are just two of the build processes that we may need in our projects. Others include code minification (to reduce file sizes), tools for analysis, and perhaps tasks that don’t have anything to do with JavaScript, like image optimization or CSS/HTML pre-processing.
The management of tasks can become a laborious thing to do, and we need a way to handle it in an automated way, being able to execute everything with simpler commands. The two most popular tools for this areGrunt.jsandGulp.js, which provide a way to organize your tasks into groups in an ordered way.
For example, you can have a command like gulp build which may run a code linter, the transpilation process with Babel, and module bundling with Browserify. Instead of having to remember three commands and their associated arguments in order, we just execute one that will handle the whole process automatically.
Wherever you find yourself manually organizing processing steps for your project, think if it can be automatized with a task runner.
Web applications have different requirements from websites. For example, while page reloads may be acceptable for a blog, that’s certainly not the case for an application like Google Docs. Your application should behave as closely as possible to a desktop one. Otherwise, the usability will be compromised.
Old-style web applications were usually done by sending multiple pages from a web server, and when a lot of dynamism was needed, content was loaded via Ajax by replacing chunks of HTML according to user actions. Although it was a big step forward to a more dynamic web, it certainly had its complications. Sending HTML fragments or even whole pages on each user action represented a waste of resources — especially of time, from the user’s perspective. The usability still didn’t match the responsiveness of desktop applications.
Looking to improve things, we created two new methods to build web applications — from the way we present them to the user, to the way we communicate between the client and the server. Although the amount of JavaScript required for an application also increased drastically, the result is now applications that behave very closely to native ones, without page reloading or extensive waiting periods each time we click a button.
Single Page Applications (SPAs)
The most common, high-level architecture for web applications is calledSPA, which stands forSingle Page Application. SPAs are big blobs of JavaScript that contain everything the application needs to work properly. The UI is rendered entirely client-side, so no reloading is required. The only thing that changes is the data inside the application, which is usually handled with a remote API viaAjaxor another asynchronous method of communication.
One downside to this approach is that the application takes longer to load for the first time. Once it has been loaded, however, transitions between views (pages) are generally a lot quicker, since it’s only pure data being sent between client and server.
Universal / Isomorphic Applications
Although SPAs provide a great user experience, depending on your needs, they might not be the optimal solution — especially if you need quicker initial response times or optimal indexing by search engines.
There’s a fairly recent approach to solving these problems, calledIsomorphic(or Universal) JavaScript applications. In this type of architecture, most of the code can be executed both on the server and the client. You can choose what you want to render on the server for a faster initial page load, and after that, the client takes over the rendering while the user is interacting with the app. Because pages are initially rendered on the server, search engines can index them properly.
Deployment
With modern JavaScript applications, the code you write is not the same as the code that you deploy for production: you only deploy the result of your build process. The workflow to accomplish this can vary depending on the size of your project, the number of developers working on it, and sometimes the tools/libraries you’re using.
For example, if you’re working alone on a simple project, each time you’re ready for deployment you can just run the build process and upload the resulting files to a web server. Keep in mind that you only need to upload the resulting files from the build process (transpilation, module bundling, minification, etc.), which can be just one .js file containing your entire application and dependencies.
You can have a directory structure like this:
├── dist
│ ├── app.js
│ └── index.html
├── node_modules
├── src
│ ├── lib
│ │ ├── login.js
│ │ └── user.js
│ ├── app.js
│ └── index.html
├── gulpfile.js
├── package.json
└── README
You thus have all of your application files in a src directory, written in ES2015+, importing packages installed with npm and your own modules from a lib directory.
Then you can run Gulp, which will execute the instructions from a gulpfile.js to build your project — bundling all modules into one file (including the ones installed with npm), transpiling ES2015+ to ES5, minifying the resulted file, etc. Then you can configure it to output the result in a convenient dist directory.
Files That Don't Need Processing
If you have files that don’t need any processing, you can just copy them from src to the dist directory. You can configure a task for that in your build system.
Now you can just upload the files from the dist directory to a web server, without having to worry about the rest of the files, which are only useful for development.
Team development
If you’re working with other developers, it’s likely you’re also using a shared code repository, like GitHub, to store the project. In this case, you can run the build process right before making commits and store the result with the other files in the Git repository, to later be downloaded onto a production server.
However, storing built files in the repository is prone to errors if several developers are working together, and you might want to keep everything clean from build artifacts. Fortunately, there’s a better way to deal with that problem: you can put a service likeJenkins,Travis CI,CircleCI, etc. in the middle of the process, so it can automatically build your project after each commit is pushed to the repository. Developers only have to worry about pushing code changes without building the project first each time. The repository is also kept clean of automatically generated files, and at the end, you still have the built files available for deployment.
Conclusion
The transition from simple web pages to modern JavaScript applications can seem daunting if you’ve been away from web development in recent years, but I hope this article was useful as a starting point. I’ve linked to more in-depth articles on each topic where possible so you can explore further.