Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =================================== Fichier users.js =========================================
- var pow = require('pow-mongodb-fixtures');
- var fixtures = pow.connect('book_phone');
- var id = pow.createObjectId;
- fixtures.load({
- users: [
- {
- "_id":id(),
- "name":"Dupont",
- "lastname":"Maurice",
- "age":"55",
- "job":"Technical support",
- "tel":"0123456789"
- },
- {
- "_id":id(),
- "name":"Valentino",
- "lastname":"Anna",
- "age":"23",
- "job":"Secretary",
- "tel":"0123456789"
- },
- {
- "_id":id(),
- "name":"Barak",
- "lastname":"Shaima",
- "age":"40",
- "job":"Financial assistant",
- "tel":"0123456789"
- }
- ]
- });
- ======================================= server.js ==============================================
- var path = require('path');
- var express = require('express');
- Promise = require('bluebird');
- mongoose = require('mongoose');
- app = express();
- //**config
- app.use(express.static('public'));
- mongoose.connect('mongodb://localhost/book_phone'');//Ici je met n'importe quoi et ça met connection REUSSIE
- mongoose.connection.once('open',function(){
- console.log("Connexion réussie!!!");
- }).on('error',function(error){
- console.log('Erreur connexion:',error);
- });
- //import models
- models = require('./models');
- //console.log(new models.User);
- console.log(new models.User);
- //import module
- require('./routing/callback.js');
- require('./routing/users.js');
- app.listen(8081);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement