<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://www.wiki.leomartin.net/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://www.wiki.leomartin.net/feed.php">
        <title>DokuWiki bwnjsejs</title>
        <description></description>
        <link>https://www.wiki.leomartin.net/</link>
        <image rdf:resource="https://www.wiki.leomartin.net/lib/tpl/dokuwiki/images/favicon.ico" />
       <dc:date>2026-04-08T17:26:24+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:adding_partials&amp;rev=1462719910&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:adding_speakers_to_the_homepage&amp;rev=1465811095&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:adding_static_content&amp;rev=1465743895&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:building_a_hello_express_application&amp;rev=1462712304&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:building_a_hello_node.js_application&amp;rev=1462707252&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:creating_additional_routes&amp;rev=1465749604&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:creating_our_header_template&amp;rev=1465743580&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:creating_routes&amp;rev=1462713830&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:finishing_our_speakers_routes_and_views&amp;rev=1465811816&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:getting_to_know_the_node_package_manager&amp;rev=1462709063&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:importing_our_data&amp;rev=1465747484&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:index&amp;rev=1462647689&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:installing_express.js&amp;rev=1462710313&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:installing_node.js&amp;rev=1462705964&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:modularizing_our_routes&amp;rev=1462732137&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:next_steps&amp;rev=1465814162&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:passing_custom_data_through_routes&amp;rev=1465748799&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:preparing_our_site_structure&amp;rev=1465742883&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:publishing_our_application&amp;rev=1465814006&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:understanding_our_data&amp;rev=1465741843&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:using_javascript_loops&amp;rev=1465748203&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:using_locals_and_conditional_templates&amp;rev=1462723149&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:using_templates&amp;rev=1462716193&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:using_the_express_generator&amp;rev=1465740587&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:what_is_express.js&amp;rev=1462709533&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:what_is_node.js&amp;rev=1462705446&amp;do=diff"/>
                <rdf:li rdf:resource="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:working_with_real_assets&amp;rev=1465741474&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://www.wiki.leomartin.net/lib/tpl/dokuwiki/images/favicon.ico">
        <title>DokuWiki</title>
        <link>https://www.wiki.leomartin.net/</link>
        <url>https://www.wiki.leomartin.net/lib/tpl/dokuwiki/images/favicon.ico</url>
    </image>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:adding_partials&amp;rev=1462719910&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-08T17:05:10+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:adding_partials</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:adding_partials&amp;rev=1462719910&amp;do=diff</link>
        <description>&lt;- Using templatesUsing locals and conditional templates -&gt;
Partials

default.ejs


&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;&lt;% include partials/head.ejs %&gt;&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;&lt;%= title %&gt;&lt;/h1&gt;
&lt;p&gt;&lt;%= content %&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;


/partials/head.ejs


  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot;&gt;
  &lt;title&gt;&lt;%= title %&gt;&lt;/title&gt;</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:adding_speakers_to_the_homepage&amp;rev=1465811095&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-13T11:44:55+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:adding_speakers_to_the_homepage</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:adding_speakers_to_the_homepage&amp;rev=1465811095&amp;do=diff</link>
        <description>&lt;- Creating additional routesFinishing our speakers' routes and views -&gt;

router.get('/', function(req, res) {
  var mes_donnees = [];
  mes_donnees = appdata.some.data;
  res.render('index', {
    title: 'Home',
    data = mes_donnees;
  });
});</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:adding_static_content&amp;rev=1465743895&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-12T17:04:55+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:adding_static_content</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:adding_static_content&amp;rev=1465743895&amp;do=diff</link>
        <description>&lt;- Creating our header templateImporting our data -&gt;
-&gt; /views/partial/content/&lt;contenu.ejs&gt; (peut être un bloc article quelquonque)

&lt;% include partials/template/&lt;nom.ejs&gt; %&gt;</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:building_a_hello_express_application&amp;rev=1462712304&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-08T14:58:24+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:building_a_hello_express_application</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:building_a_hello_express_application&amp;rev=1462712304&amp;do=diff</link>
        <description>&lt;- Installing Express.jsCreating routes -&gt;
var express = require('express');

var app = express();

app.get('/', function(req, res) {
  res.send('&lt;h1&gt;😝&lt;/h1&gt;&lt;p&gt;Hello !&lt;/p&gt;')
})

var server = app.listen(3000, function() {
  console.log('Listening on port 3000.');
})


-&gt; &lt;http://expressjs.com/en/4x/api.html&gt;</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:building_a_hello_node.js_application&amp;rev=1462707252&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-08T13:34:12+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:building_a_hello_node.js_application</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:building_a_hello_node.js_application&amp;rev=1462707252&amp;do=diff</link>
        <description>&lt;- Installing Node.jsGetting to know the node package manager -&gt;
	*  build-in modules
	*  modules installés


// on importe le module http
var http = require('http');

// on créé le serveur
// + on passe en argument une fonction / fonction anonyme comme callback pour les requêtes
// avec elle-même comme argument request et response
var serveur = http.createServer(function(request, response) {
  // contenu du callback
  // un serveur envoie un header
  console.log(&quot;Requête&quot;);
  response.writeHead…</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:creating_additional_routes&amp;rev=1465749604&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-12T18:40:04+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:creating_additional_routes</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:creating_additional_routes&amp;rev=1465749604&amp;do=diff</link>
        <description>&lt;- Passing custom data through routesAdding speakers to the homepage -&gt;
-&gt; routes/index.js</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:creating_our_header_template&amp;rev=1465743580&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-12T16:59:40+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:creating_our_header_template</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:creating_our_header_template&amp;rev=1465743580&amp;do=diff</link>
        <description>&lt;- Preparing our site structureAdding static content -&gt;
...</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:creating_routes&amp;rev=1462713830&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-08T15:23:50+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:creating_routes</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:creating_routes&amp;rev=1462713830&amp;do=diff</link>
        <description>&lt;- Building a Hello Express applicationUsing templates -&gt;

var express = require('express');

var app = express();

app.get('/', function(req, res) {
  res.send('&lt;h1&gt;😝&lt;/h1&gt;&lt;p&gt;Hello !&lt;/p&gt;')
})
app.get('/fr', function(req, res) {
  res.send('&lt;h1&gt;😝&lt;/h1&gt;&lt;p&gt;Bonjour !&lt;/p&gt;')
})

app.get('/who/:name?', function(req, res) {
  var name = req.params.name;
  res.send('&lt;h1&gt;😝&lt;/h1&gt;&lt;p&gt;Hello ' + name + ' !&lt;/p&gt;')
})

app.get('/who/:name?/:title', function(req, res) {
  var name = req.params.name;
  var title = re…</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:finishing_our_speakers_routes_and_views&amp;rev=1465811816&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-13T11:56:56+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:finishing_our_speakers_routes_and_views</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:finishing_our_speakers_routes_and_views&amp;rev=1465811816&amp;do=diff</link>
        <description>&lt;- Adding speakers to the homepagePublishing our application -&gt;
...</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:getting_to_know_the_node_package_manager&amp;rev=1462709063&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-08T14:04:23+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:getting_to_know_the_node_package_manager</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:getting_to_know_the_node_package_manager&amp;rev=1462709063&amp;do=diff</link>
        <description>&lt;- Building a Hello Node.js applicationWhat is Express.js -&gt;
Node Packet Manager

-&gt; npmjs.com

init


npm init // aide à la création du fichier JSON package.json
name: nom de l'application
version:
description:
entry point: l'application runnée par défaut
test command:
git repository:
keywords:
author:
license:</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:importing_our_data&amp;rev=1465747484&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-12T18:04:44+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:importing_our_data</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:importing_our_data&amp;rev=1465747484&amp;do=diff</link>
        <description>&lt;- Adding static contentUsing JavaScript loops -&gt;
Merger views et données.

Importer du JSON dans une variable :


var data = require('/path/to/data.json');
// ou
app.locals.appdata = require('/path/to/data.json');



&lt;%= appdata.my.data.from.json %&gt;</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:index&amp;rev=1462647689&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-07T21:01:29+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:index</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:index&amp;rev=1462647689&amp;do=diff</link>
        <description>Building a Website with Node.js and Express.js

- Introduction

	*  Welcome
	*  What you should know
	*  Using the exercise files

- Getting Started with Node.js

	*  What is Node.js
	*  Installing Node.js
	*  Building a Hello Node.js application
	*  Getting to know the node package manager

- Using Express.js

	*  What is Express.js
	*  Installing Express.js
	*  Building a Hello Express application
	*  Creating routes
	*  Using templates
	*  Adding partials
	*  Using locals and conditional temp…</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:installing_express.js&amp;rev=1462710313&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-08T14:25:13+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:installing_express.js</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:installing_express.js&amp;rev=1462710313&amp;do=diff</link>
        <description>&lt;- What is Express.jsBuilding a Hello Express application -&gt;
Installer express.js

Installer globalement et localement.

npm install -g express

express --version

npm install express --save</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:installing_node.js&amp;rev=1462705964&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-08T13:12:44+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:installing_node.js</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:installing_node.js&amp;rev=1462705964&amp;do=diff</link>
        <description>&lt;- What is Node.jsBuilding a Hello Node.js application -&gt;
Tester sa présence :

node --version

os x

-&gt; nodejs.org

linux

voir installer_nodejs_sous_linux</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:modularizing_our_routes&amp;rev=1462732137&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-08T20:28:57+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:modularizing_our_routes</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:modularizing_our_routes&amp;rev=1462732137&amp;do=diff</link>
        <description>&lt;- Using locals and conditional templatesUsing the Express Generator -&gt;
index.js


var express = require('express');
var app = express();
var routes = require('./routes');

app.set('view engine', 'ejs');

app.locals.pagetitle = 'Awesome Website';

app.get('/', routes.index);
app.get('/about', routes.about);

// si on a autre chose
app.get('*', function (req, res) {
  console.log('Page inconnue demandée');
  res.render('default', { title: '😭', content: '😭😭😭' });
});

var server = app.listen(3000,…</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:next_steps&amp;rev=1465814162&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-13T12:36:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:next_steps</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:next_steps&amp;rev=1465814162&amp;do=diff</link>
        <description>&lt;- Publishing our application -&gt;
Node for front-end developers -&gt; O'Reilly

Node.js in action -&gt; Manning Publication co</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:passing_custom_data_through_routes&amp;rev=1465748799&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-12T18:26:39+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:passing_custom_data_through_routes</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:passing_custom_data_through_routes&amp;rev=1465748799&amp;do=diff</link>
        <description>&lt;- Using JavaScript loopsCreating additional routes -&gt;
app.locals(.appdata) non disponible dans routes/


//routes/index.js
(...)
var appdata = require('path/to/data.json');



(html)
&lt;% if (some.data.length &gt; 0 { %&gt;
  &lt;% for (i=0; i&lt;some.data.length; i++) { %&gt;
    &lt;li&gt;some.data[i]
  &lt;% } %&gt;
&lt;% } %&gt;</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:preparing_our_site_structure&amp;rev=1465742883&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-12T16:48:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:preparing_our_site_structure</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:preparing_our_site_structure&amp;rev=1465742883&amp;do=diff</link>
        <description>&lt;- Understanding our dataCreating our header template -&gt;

/views/partial/content/
              /template/head.ejs
                        header.ejs
                        footer.ejs
                        jsdefault.ejs



// index.ejs
(...)
  &lt;head&gt;&lt;% include partials/template/head.ejs %&gt;&lt;/head&gt;
(...)</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:publishing_our_application&amp;rev=1465814006&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-13T12:33:26+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:publishing_our_application</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:publishing_our_application&amp;rev=1465814006&amp;do=diff</link>
        <description>&lt;- Finishing our speakers' routes and viewsNext steps -&gt;
-&gt; heroku.com

-&gt; possibilité de créer le dépôt git sur heroku.com et de faire une copie locale

-&gt; Procfile


// commande pour heroku
web: node bin/www


git init

git add.

git commit -m “message”

heroku login

keroku git:remote -a &lt;nom du projet&gt;</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:understanding_our_data&amp;rev=1465741843&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-12T16:30:43+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:understanding_our_data</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:understanding_our_data&amp;rev=1465741843&amp;do=diff</link>
        <description>&lt;- Working with real assetsPreparing our site structure -&gt;
-&gt; &lt;http://www.jsoneditoronline.org/&gt;</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:using_javascript_loops&amp;rev=1465748203&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-12T18:16:43+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:using_javascript_loops</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:using_javascript_loops&amp;rev=1465748203&amp;do=diff</link>
        <description>&lt;- Importing our dataPassing custom data through routes -&gt;

&lt;% appdata.some.data.forEach(function(item) { %&gt;
  &lt;li&gt;&lt;% item.name %&gt;&lt;/li&gt;
&lt;% }); %&gt;</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:using_locals_and_conditional_templates&amp;rev=1462723149&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-08T17:59:09+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:using_locals_and_conditional_templates</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:using_locals_and_conditional_templates&amp;rev=1462723149&amp;do=diff</link>
        <description>&lt;- Adding partialsModularizing our routes -&gt;
Locals : informations que l'on veut retrouver dans toutes les pages.

index.js


var express = require('express');
var app = express();

app.set('view engine', 'ejs');

app.locals.pagetitle = &quot;Awesome Website&quot;;

app.get('/', function(req, res) {
  console.log('/ requested');
  res.render('default', { title: 'Hello', content: 'Heyyy salut-donc !', users: ['Mireille', 'José', 'Marcel', 'Odette', 'Lucien', 'Félicienne'] });
})

// si on a autre chose
app…</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:using_templates&amp;rev=1462716193&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-08T16:03:13+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:using_templates</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:using_templates&amp;rev=1462716193&amp;do=diff</link>
        <description>&lt;- Creating routesAdding partials -&gt;
Templating

Par défaut jade.

On utilisera ici EJS.

npm install ejs --save

Par défaut les templates sont à mettre dans un dossier views.

Si on omet le tag = -&gt; &lt;%= js %&gt; on peut écrire du javascript normal.

index.js


var express = require('express');
var app = express();

app.set('view engine', 'ejs');
// si par exemple dossier vues au lieu de views
// app.set('views', __dirname + '/vues');

app.get('/', function(req, res) {
  console.log('/ requested');…</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:using_the_express_generator&amp;rev=1465740587&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-12T16:09:47+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:using_the_express_generator</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:using_the_express_generator&amp;rev=1465740587&amp;do=diff</link>
        <description>&lt;- Modularizing our routesWorking with real assets -&gt;
	*  s'assurer qu'on est dans le bon dossier et que le générateur express est installé
		*  -&gt; sudo npm install -g express-generator
		*  express -e &lt;nom-du-projet&gt;
		*  la dernière commande donne des instructions pour installer les dépendances et lancer l'application :</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:what_is_express.js&amp;rev=1462709533&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-08T14:12:13+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:what_is_express.js</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:what_is_express.js&amp;rev=1462709533&amp;do=diff</link>
        <description>&lt;- Getting to know the node package managerInstalling Express.js -&gt;
Qu'est-ce qu'express ?

	*  un framework Node.js
	*  fournit une structure à Node.js
	*  grâce à un langage de templating (templating language/engine)
		*  jade (défaut)
		*  EJS (utilisé ici)

	*  fourni un mécanisme de routage
		*  ce qui est utilisé pour les single page applications</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:what_is_node.js&amp;rev=1462705446&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-08T13:04:06+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:what_is_node.js</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:what_is_node.js&amp;rev=1462705446&amp;do=diff</link>
        <description>&lt;- Using the exercise filesInstalling Node.js -&gt;
Features clés de nodejs

	*  event driven
	*  non-blocking
	*  handles two-way connections
	*  really good at real-time applications

Conséquence du non-blocking : peut gérer de nombreuses connexions simultanées. Très bien pour des applis ou le serveur à besoin d'envoyer des données au client.</description>
    </item>
    <item rdf:about="https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:working_with_real_assets&amp;rev=1465741474&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-06-12T16:24:34+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>bwnjsejs:working_with_real_assets</title>
        <link>https://www.wiki.leomartin.net/doku.php?id=bwnjsejs:working_with_real_assets&amp;rev=1465741474&amp;do=diff</link>
        <description>&lt;- Using the Express GeneratorUnderstanding our data -&gt;
...</description>
    </item>
</rdf:RDF>
