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
<html ng-app="testController"> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script> | |
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js" type="text/javascript"></script> | |
<script src="http://m-e-conroy.github.io/angular-dialog-service/javascripts/dialogs.min.js" type="text/javascript"></script> | |
<link href="https://fonts.googleapis.com/css?family=PT+Sans+Narrow" rel="stylesheet"> | |
</head> | |
<body ng-controller="animeCtrl as ctrl"> |
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
<div> | |
<svg width="150" height="300" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> | |
<text x="0" y="10" | |
font-family="Verdana" | |
font-size="10"> | |
<tspan x="0" dy="1.2em" font-weight="bold">Animation 1<tspan> | |
<tspan x="0" dy="1.2em" font-weight="normal">Translation simple<tspan> | |
</text> | |
<g> |
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
// Chargement de la bibliothèque express | |
var express = require('express'); | |
var app = express(); | |
/* Création d'une route. Chaque route correspondra à un URL différent. | |
Ici cela correspond à http://mon_adresse/ | |
Si nous avions app.get('/name', function (req, res) { | |
La route serait http://mon_adresse/name | |
*/ | |
app.get('/', function (req, res) { |
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
mkdir mon_app # Création d'un dossier qui contiendra votre code | |
cd mon_app | |
npm init # Initialisation du projet | |
npm install express --save # Installation de votre première bibliothèque |
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
node app.js |
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
// Création de la route /hello | |
app.get('/hello', function(req, res) { | |
// Récupération du paramètre "name" | |
var name = req.param('name'); | |
// Création et envoi de la réponse | |
res.send('GET: Hello ' + name); | |
}); |
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
npm install --save body-parser |
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
// Chargement de la bibliothèque body parser | |
var bodyParser = require('body-parser') | |
app.use(bodyParser.json()); | |
// Création d'une route post | |
app.post('/name', function(req, res) { | |
//Récupération de la propriété name dans le body | |
var name = req.body.name; | |
res.send('POST: hello ' + name); | |
}); |
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
npm install request --save |
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
// Chargement de la requête | |
var request = require('request'); | |
// Création d'une nouvelle route GET | |
app.get('/wikipedia', function(req, res) { | |
// Envoi d'une requête vers une api (GET) | |
request.get({ | |
url: "https://en.wikipedia.org/api/rest_v1/page/" | |
}, function(error, response, body) { |
OlderNewer