web:javascript:mean_stack:demarrage
Table des matières
Démarrage d'un projet MEAN Stack
Infrastructure complète en JavaScript :
- MongoDB
- ExpressJS
- AngularJS
- NodeJS
Mise en place de l'environnement
- Installation d'Express.
Packages npm
- Faire un
npm initdans le répertoire nouvellement créé. - Installer les packages npm suivants (globalement, ajouter
-gà la fin) :npm install nodemon -gnpm install express jade --save(install jade globally to build from Sublime Text)npm install bower -gnpm install stylus --savenpm install body-parser --save(était dans ExpressJS 3.x, mais pas dans ExpressJS 4.x)npm install morgan --save(remplaceloggerqui é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
- bodyparser
- logger
session
Utiliser, par exemple:
app.use(session({ secret: 'multi vision unicorns', resave: true, saveUninitialized: true }));
Ajouter Git
git init- Ajouter le fichier
.gitignorenode_modules .gitignore
git add -Agit commit -m "First commit."
Configuration de Bower
- Créer un fichier
.bowerrc:{ "directory": "public/vendor" } - Faire
bower initet répondre aux questions. - Un fichier
bower.jsonest créé. - 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 : de 127.0.0.1
