Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. 'use strict';
  2.  
  3. var mongoose = require('mongoose'),
  4. fs = require('fs'),
  5. express = require('express');
  6.  
  7. mongoose.set('debug', true);
  8.  
  9. // Bootstrap db connection
  10. var db = mongoose.connect('mongodb://localhost/test', {
  11. options: {
  12. ssl: true,
  13. port: 27017,
  14. user: 'xxxxxxxx',
  15. pass: 'xxxxxxxx_',
  16. sslValidate: false,
  17. checkServerIdentity: false,
  18. sslCA: fs.readFileSync('./config/sslcerts/mongodb.pem'),
  19. sslCert: fs.readFileSync('./config/sslcerts/mongodb-cert.crt'),
  20. sslKey: fs.readFileSync('./config/sslcerts/mongodb-cert.key'),
  21. sslPass: 'xxxxxx'
  22. },
  23. },
  24. function(err) {
  25. console.error('Could not connect to MongoDB!');
  26. console.log(err);
  27. });
  28.  
  29. // Init the express application
  30. var app = require('express')(db);
  31.  
  32. app.listen(8443);
  33. console.log('MEAN.JS application started on port ' + 8443);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement