Created
March 13, 2018 21:27
-
-
Save Peregg/3ac61f0c3a5c4ae798724ea00cf31f8d to your computer and use it in GitHub Desktop.
quest node http
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<% include ../partials/head %><!--Cette balise appelle une section head indépendante dans mon dossier partials--> | |
</head> | |
<body class="container"> | |
<header> | |
<% include ../partials/header %><!--Cette balise appelle une section header indépendante dans mon dossier partials--> | |
</header> | |
<main> | |
<div class="test"> | |
<h2>A propos de moi :</h2> | |
<p>Et non ! Je ne me suis pas contenté d'une page ! J'ai une section about ! Quel foufou je suis ! J'adore Node ! Merci Express ! Vive EJS !!! </p> | |
</div> | |
</main> | |
<footer> | |
<% include ../partials/footer %><!--Cette balise appelle un footer indépendant dans mon dossier partials--> | |
</footer> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--Cette section est appelée grace à la balise <% include ../partials/head %> et s'affiche sur mes pages | |
http://localhost:3000/ et http://localhost:3000/about--> | |
<meta charset="UTF-8"> | |
<title>J'adore NodeJS!</title> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--Cette section est appelée grace à la balise <% include ../partials/header %> et s'affiche sur mes pages | |
http://localhost:3000/ et http://localhost:3000/about--> | |
<h1> J'adore NodeJS et EJS !!!!</h1> | |
<a href="http://localhost:3000/">Home</a> | |
<a href="http://localhost:3000/about">A propos...</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<% include ../partials/head %><!--Cette balise appelle une section head indépendante dans mon dossier partials--> | |
</head> | |
<body class="container"> | |
<header> | |
<% include ../partials/header %><!--Cette balise appelle une section header indépendante dans mon dossier partials--> | |
</header> | |
<main> | |
<div class="test"> | |
<h2>Node c'est la vie !</h2> | |
<p>J'adore Node et j'ai accompli la quête Node avec un grand plaisir !!!!!! Chaque instant fut un pur bonheur ! Merci la Wild !</p> | |
</div> | |
</main> | |
<footer> | |
<% include ../partials/footer %><!--Cette balise appelle un footer indépendant dans mon dossier partials--> | |
</footer> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// server.js | |
// load the things we need | |
var express = require('express'); | |
var app = express(); | |
// set the view engine to ejs | |
app.set('view engine', 'ejs'); | |
// use res.render to load up an ejs view file | |
// index page | |
app.get('/', function(req, res) { | |
res.render('pages/index'); | |
}); | |
// about page | |
app.get('/about', function(req, res) { | |
res.render('pages/about'); | |
}); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment