Outils pour utilisateurs

Outils du site


web:javascript:mean_stack:demarrage

Démarrage d'un projet MEAN Stack

Infrastructure complète en JavaScript :

  • MongoDB
  • ExpressJS
  • AngularJS
  • NodeJS

Mise en place de l'environnement

Packages npm

  1. Faire un npm init dans le répertoire nouvellement créé.
  2. Installer les packages npm suivants (globalement, ajouter -g à la fin) :
    • npm install nodemon -g
    • npm install express jade --save (install jade globally to build from Sublime Text)
    • npm install bower -g
    • npm install stylus --save
    • npm install body-parser --save (était dans ExpressJS 3.x, mais pas dans ExpressJS 4.x)
    • npm install morgan --save (remplace logger qui était dans ExpressJS 3.x)
    • npm install mongoose --save (voir Mongoose pour plus d'informations)
    • npm install express-session --save

Les installations suivantes sont facultatives, mais utiles :

  • Yeoman : npm install -g yo
  • Grunt: npm install -g grunt-cli
  • Angular Generator : npm install -g generator-angular

Ce processus crée un fichier package.json.

Packages middleware d'ExpressJS qui n'y sont plus

session

Utiliser, par exemple:

app.use(session({
  secret: 'multi vision unicorns',
  resave: true,
  saveUninitialized: true
}));

Voir https://github.com/senchalabs/connect#middleware

Ajouter Git

  1. git init
  2. Ajouter le fichier .gitignore
    node_modules
    .gitignore
  3. git add -A
  4. git commit -m "First commit."

Configuration de Bower

  1. Créer un fichier .bowerrc :
    {
      "directory": "public/vendor"
    } 
  2. Faire bower init et répondre aux questions.
  3. Un fichier bower.json est créé.
  4. Installer les packages bower :
    • jQuery : bower install jquery --save
    • Bootstrap : bower install bootstrap --save
    • toastr : bower install toastr --save
    • AngularJS : bower install angular angular-resource --save
    • Angular UI Router : bower install angular-ui-router --save
    • Angular UI Bootstrap : bower install angular-ui-bootstrap --save

Créer le fichier server.js

Passport

Yeoman

Installation

npm install -g yo

Démarrer un projet AngularJS

yo angular

Sources

web/javascript/mean_stack/demarrage.txt · Dernière modification : 2022/02/02 00:42 de 127.0.0.1