BVB Source Codes

waterline Show raw-example.js Source code

Return Download waterline: download raw-example.js Source code - Download waterline Source code - Type:.js
  1. #!/usr/bin/env node
  2.  
  3.  
  4. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5. // `raw-example.js`
  6. //
  7. // This is an example demonstrating how to use Waterline
  8. // from a vanilla Node.js script.
  9. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10.  
  11.  
  12. // Import dependencies
  13. var setupWaterline = require('./bootstrap');
  14. var SailsDiskAdapter = require('sails-disk');
  15.  
  16.  
  17. // Set up Waterline.
  18. setupWaterline({
  19.  
  20.  
  21.   adapters: {
  22.  
  23.     'sails-disk': SailsDiskAdapter
  24.  
  25.   },
  26.  
  27.  
  28.   datastores: {
  29.  
  30.     myDb: {
  31.       adapter: 'sails-disk'
  32.     }
  33.  
  34.   },
  35.  
  36.  
  37.   models: {
  38.  
  39.     user: {
  40.       connection: 'myDb',//<< the datastore this model should use
  41.       attributes: {}
  42.     }
  43.  
  44.   }
  45.  
  46.  
  47. }, function waterlineReady (err, ontology) {
  48.   if (err) {
  49.     console.error('Could not set up Waterline: '+err.stack);
  50.     return;
  51.   }//--鈥
  52.  
  53.  
  54.  
  55.   // Our model definitions
  56.   console.log(
  57.     '\n'+
  58.     '\n'+
  59.     '==========================================================================\n'+
  60.     '鈥 Model definitions:                                                     鈥n'+
  61.     '==========================================================================\n',
  62.     ontology.models
  63.   );
  64.   //
  65.   // e.g.
  66.   // models.user.find().exec(...)
  67.   // models.user.find().exec(...)
  68.  
  69.  
  70.   // Our datastore definitions
  71.   console.log(
  72.     '\n'+
  73.     '\n'+
  74.     '==========================================================================\n'+
  75.     '鈥 Datastore definitions:                                                 鈥n'+
  76.     '==========================================================================\n',
  77.     ontology.datastores
  78.   );
  79.   //
  80.   // e.g.
  81.   // datastores.myDb.config;
  82.  
  83.  
  84.   console.log();
  85.   console.log();
  86.   console.log('--');
  87.   console.log('Waterline is ready.');
  88.   console.log('(this is where you could write come code)');
  89.  
  90. });
  91.  
  92.  
downloadraw-example.js Source code - Download waterline Source code
Related Source Codes/Software:
notepad-plus-plus - Notepad++ official repository h... 2017-01-10
che - Eclipse Che: Next-generation Eclipse IDE. Open sou... 2017-01-10
Gource - oftware version control visualization ... 2017-01-10
FDFullscreenPopGesture - A UINavigationController's category to enable full... 2017-01-10
node-style-guide - A guide for styling your node.js / JavaScript code... 2017-01-09
Workerman - An asynchronous event driven PHP framework for eas... 2017-01-10
structor - An advanced visual editor for React components ... 2017-01-10
golearn - Machine Learning for Go 2017-01-10
poisontap - Exploits locked/password protected computers over ... 2017-01-10
kcptun - A Simple UDP Tunnel Based On KCP 2017-01-11
discover-flask - Full Stack Web Development with Flask. ... 2017-01-12
spring-mvc-showcase - Demonstrates the features of the Spring MVC web fr... 2017-01-12
tushare - TuShare is a utility for crawling historical data ... 2017-01-12
raml-spec - RAML Specification http://raml.... 2017-01-12
android-stackblur - Android StackBlur is a library that can perform a ... 2017-01-12
sound-redux - A Soundcloud client built with React / Redux ... 2017-01-12
httpstat - curl statistics made simple 2017-01-12
vim - Vim configuration file and plug-ins 2017-01-12
appframework - The definitive HTML5 mobile javascript framework ... 2017-01-12
BaiduExporter - Assistant for Baidu to export download links to ar... 2017-01-11

 Back to top