Browse Source

Add Sequelize to nodejs.

Edward Bramanti 10 years ago
parent
commit
dd6b50acaa
1 changed files with 33 additions and 0 deletions
  1. 33 0
      frameworks/JavaScript/nodejs/hello.js

+ 33 - 0
frameworks/JavaScript/nodejs/hello.js

@@ -25,6 +25,39 @@ var WorldSchema = new mongoose.Schema({
   }),
   }),
   MWorld = conn.model('World', WorldSchema);
   MWorld = conn.model('World', WorldSchema);
 
 
+var sequelize = new Sequelize('hello_world', 'benchmarkdbuser', 'benchmarkdbpass', {
+  host: 'localhost',
+  dialect: 'mysql',
+  logging: false,
+  pool: {
+    max: 5000,
+    min: 0,
+    idle: 5000
+  }
+});
+
+var World = sequelize.define('World', {
+  id: {
+    type: 'Sequelize.INTEGER'
+  },
+  randomNumber: {
+    type: 'Sequelize.INTEGER'
+  }
+}, {
+  timestamps: false,
+  freezeTableName: true
+});
+var Fortune = sequelize.define('Fortune', {
+  id: {
+    type: 'Sequelize.INTEGER'
+  },
+  message: {
+    type: 'Sequelize.STRING'
+  }
+}, {
+  timestamps: false,
+  freezeTableName: true
+});
 
 
 // Helper functions
 // Helper functions
 function getRandomNumber() {
 function getRandomNumber() {