\chapter{Node.js}
\section{Installation and upgrade}
\subsection{Ubuntu}
\url{https://github.com/nodesource/distributions#installation-instructions}

\subsection{Windows}
\url{https://nodejs.org}
\url{https://www.npmjs.com}

You need to add an environment variable as described in \url{http://stackoverflow.com/questions/9587665}.

\section{Introduction}
\url{https://github.com/maxogden/art-of-node}

\url{https://github.com/substack/stream-handbook}

\url{http://requirebin.com}

\url{http://nodeschool.io}

\url{https://github.com/workshopper/learnyounode}

\url{http://chimera.labs.oreilly.com/books/1234000000262/index.html}

\url{http://jsbooks.revolunet.com}

\verb|mkdir myapp|
\verb|cd myapp|
\verb|npm init|
\verb|npm i --save express|

\section{API}
\subsection{\texttt{Process}}
From \url{https://nodejs.org/dist/latest-v6.x/docs/api/process.html}:
\begin{quote}
The process object is a global that provides information about, and control over, the current Node.js process. As a global, it is always available to Node.js applications without using require().
\end{quote}

\begin{scriptsize}
\begin{minted}[tabsize=2, linenos=true, startinline=true]{js}

\end{minted}
\end{scriptsize}

\section{async}

\section{Sessions}
\url{https://stormpath.com/blog/everything-you-ever-wanted-to-know-about-node-dot-js-sessions}

\section{Authentication}

\subsection{JSON Web Tokens}
\url{https://en.wikipedia.org/wiki/JSON_Web_Token}

JWT should not be used for sessions:

\url{http://cryto.net/~joepie91/blog/2016/06/13/stop-using-jwt-for-sessions}

Node JSON Web Token implementation (symmetric and asymmetric):
\url{https://www.npmjs.com/package/jsonwebtoken}

\url{https://github.com/dwyl/learn-json-web-tokens}

JSON Web Algorithms (JWA)
\url{https://tools.ietf.org/html/rfc7518#page-9}

\url{https://scotch.io/tutorials/authenticate-a-node-js-api-with-json-web-tokens}

JWT with socket.io:
\url{https://auth0.com/blog/2014/01/15/auth-with-socket-io}

Debugger:
\url{https://jwt.io}

\section{Automatic script restart}
nodemon \url{https://www.npmjs.com/package/nodemon}
