瀏覽代碼

nettoyage

Benoît Hubert 8 年之前
父節點
當前提交
ec7cbf3d60
共有 13 個文件被更改,包括 0 次插入260 次删除
  1. 0 17
      backend-init.js
  2. 0 74
      backend.js
  3. 0 32
      editor.html
  4. 0 0
      html5bp/LICENSE.txt
  5. 0 0
      html5bp/browserconfig.xml
  6. 0 0
      html5bp/humans.txt
  7. 0 0
      html5bp/icon.png
  8. 0 0
      html5bp/robots.txt
  9. 0 0
      html5bp/site.webmanifest
  10. 0 0
      html5bp/tile-wide.png
  11. 0 0
      html5bp/tile.png
  12. 0 135
      old.html
  13. 0 2
      some-text.html

+ 0 - 17
backend-init.js

@@ -1,17 +0,0 @@
-var express      = require('express');
-var bodyParser   = require('body-parser');
-var cors         = require('cors');
-var app          = express();
-
-app.use(cors());
-
-app.use(function(req, res, next) {
-   res.header("Access-Control-Allow-Origin", "*");
-   res.header('Access-Control-Allow-Methods', 'DELETE, PUT, GET, POST');
-   res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
-   next();
-});
-app.use(express.static(__dirname));
-app.use(bodyParser.json());
-
-module.exports = app;

+ 0 - 74
backend.js

@@ -1,74 +0,0 @@
-/**
- * Initialisation du serveur
- */
-var app = require('./backend-init');
-
-
-/**
- * Création d'un tableau vide où on va stocker les utilisateurs
- */
-var userList = [];
-var userId = 1;
-
-/**
- * Création d'un utilisateur : on le stocke dans le tableau userList
- * ATTENTION ! Dans la "vraie vie", on utiliserait une base de données !
- */
-function createNewUser(user) {
-
-  // On vérifie que les données de l'utilisateur sont renseignées
-  // Si non, on renvoie false
-  if(! user || ! user.username || ! user.email || ! user.password) {
-    return false;
-  }
-
-  // L'étape de vérification a réussi, on insère l'utilisateur dans le tableau
-  // On crée un faux "id" pour simuler une insertion SQL. En SQL les "id" sont
-  // incrémentés à chaque insertion. On simule cela en incrémentant un compteur
-  // "userId" à chaque insertion
-  userList.push({
-    id: userId++,
-    username: user.username,
-    email:    user.email,
-    password: user.password
-  });
-  return true;
-}
-
-
-/**
- * Ce code va gérer la requête POST vers l'URL /register de notre micro-serveur
- */
-app.post('/register', function(req, res) {
-
-  // Les données envoyées par le client (navigateur) sont dans la propriété "body"
-  // de l'objet req (pour request)
-  var user = req.body;
-
-  // createNewUser() va nous renvoyer true ou false
-  var success = createNewUser(user);
-
-  if(success) {
-    // Envoyer un message sur la console du serveur
-    console.log('Utilisateur enregistré: ', user, '\nListe des utilisateurs', userList);
-    res.json({ user: user });
-  }
-  else {
-    res.status(400).json({ error: 'Champs manquants dans la requête' });
-  }
-});
-
-app.get('/username-check', function(req, res) {
-  var username = req.query.username;
-  for(u = 0 ; u < userList.length ; u++) {
-    if(username === userList[u].username) {
-      return res.json({ success: false });
-    }
-  }
-  res.json({ success: true });
-});
-
-
-
-console.log('Le serveur écoute sur le port 3001. Laissez cette console ouverte !')
-app.listen(3001);

+ 0 - 32
editor.html

@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<title>ACE in Action</title>
-<style type="text/css" media="screen">
-    #editor { 
-        position: absolute;
-        top: 0;
-        right: 50%;
-        bottom: 0;
-        left: 0;
-    }
-</style>
-</head>
-<body>
-
-<div id="editor">function foo(items) {
-    var x = "All this is syntax highlighted";
-    return x;
-}</div>
-    
-<script src="ace/build/src/ace.js" type="text/javascript" charset="utf-8"></script>
-<script>
-    var editor = ace.edit("editor");
-    editor.setTheme("ace/theme/eclipse");
-    editor.getSession().setMode("ace/mode/javascript");
-    editor.getSession().on('change', function() {
-    console.log(arguments)
-    });
-</script>
-</body>
-</html>

LICENSE.txt → html5bp/LICENSE.txt


browserconfig.xml → html5bp/browserconfig.xml


humans.txt → html5bp/humans.txt


icon.png → html5bp/icon.png


robots.txt → html5bp/robots.txt


site.webmanifest → html5bp/site.webmanifest


tile-wide.png → html5bp/tile-wide.png


tile.png → html5bp/tile.png


+ 0 - 135
old.html

@@ -1,135 +0,0 @@
-<!doctype html>
-<html class="no-js" lang="">
-    <head>
-        <meta charset="utf-8">
-        <meta http-equiv="x-ua-compatible" content="ie=edge">
-        <title>Formation jQuery</title>
-        <meta name="description" content="">
-        <meta name="viewport" content="width=device-width, initial-scale=1">
-
-        <link rel="manifest" href="site.webmanifest">
-        <link rel="apple-touch-icon" href="icon.png">
-        <!-- Place favicon.ico in the root directory -->
-
-        <link rel="stylesheet" href="css/normalize.css">
-        <link rel="stylesheet" href="css/main.css">
-        <link rel="stylesheet" href="css/styles.css">
-        <style>
-        a,
-        span,
-        button {
-            margin: 5px;
-            box-sizing: border-box;
-        }
-        .bordure-flashy {
-            border: 2px solid red;
-        }
-        </style>
-    </head>
-    <body>
-        <!--[if lte IE 9]>
-            <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
-        <![endif]-->
-
-        <!-- Add your site or application content here -->
-        <div class="container">
-        <!-- <a href="#" class="main">lien 1</a> <a href="#">lien 2</a> -->
-
-        <h2>jQuery</h2>
-            <form id="formNouveauProduit">
-                <input id="nomProduit" name="nomProduit" type="text" />
-                <input type="submit" class="blue" value="Ajouter" />
-            </form>
-
-            <div id="produits">
-                <div>
-                    <span>Produit 2a</span><button class="red" id="monBouton2a">Supprimer</button>
-                </div>
-                <div>
-                    <span>Produit 2b</span><button class="red" id="monBouton2b">Supprimer</button>
-                </div>
-                <div>
-                    <span>Produit 2c</span><button class="red" id="monBouton2c">Supprimer</button>
-                </div>
-                <div>
-                    <span>Produit 2d</span><button class="red" id="monBouton2d">Supprimer</button>
-                </div>
-            </div>
-        </div>
-        <script src="js/vendor/modernizr-3.5.0.min.js"></script>
-        <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
-        <script>window.jQuery || document.write('<script src="js/vendor/jquery-3.2.1.min.js"><\/script>')</script>
-        <script src="js/plugins.js"></script>
-        <script src="js/main.js"></script>
-
-        <!-- Google Analytics: change UA-XXXXX-Y to be your site's ID. -->
-        <script>
-            window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
-            ga('create','UA-XXXXX-Y','auto');ga('send','pageview')
-        </script>
-        <script src="https://www.google-analytics.com/analytics.js" async defer></script>
-        <script>
-          "use strict";
-          $(document).ready(function() {
-
-            // var button1 = document.getElementById('monBouton1');
-            // button1.innerHTML = 'Click me (DOM)';
-
-            // var button2 = $('#monBouton2');
-            // button2.html('Click me (jQuery)');
-
-            // var buttons1 = document.getElementsByClassName('blue');
-            // for(var i = 0 ; i < buttons1.length ; i++) {
-            //     buttons1[i].innerHTML = 'Remove';
-            // }
-
-            $('.red')
-            .html('Remove')
-            .removeClass('red')
-            .addClass('green');
-
-            $('button')
-            .click(
-                function(event) {
-                    var button = $(this);
-                    var row = button.parent();
-                    row.remove();
-                }
-            )
-
-            $('#formNouveauProduit')
-            .submit(
-                function(event) {
-                    event.preventDefault();
-                    var nomProduit = $('#nomProduit').val();
-                    var ligneProduit = $('<div><span>' + nomProduit + '</span><button class="red">Supprimer</button></div>');
-                    ligneProduit.appendTo('#produits');
-
-                }
-            )
-
-            // $('a')
-            // .find('.main')
-            // .css({
-            //     'text-decoration': 'none',
-            //     color: 'green'
-            // });
-
-          });
-        </script>
-    </body>
-</html>
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 0 - 2
some-text.html

@@ -1,2 +0,0 @@
-<h2>This is an example</h2>
-<p>I got this text with an AJAX request</p>