Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TypeError: models.channels.create is not a constructor
- user.js //contains user table schema
- news.js //contains news table schema
- var users = require( './user' );
- var news = require( './news' );
- module.exports = {
- users:users,
- news:news
- };
- var config = require('../config');
- module.exports = function(schema){
- var users = config.define('channels', {
- user_name: { type: schema.String, limit: 30 },
- ...
- created_at: { type: schema.Date },
- updated_at: { type: schema.Date }
- });
- return users;
- };
- var caminte = require( 'caminte' ),
- Schema = caminte.Schema,
- config = {
- driver: "mysql",
- host: "localhost",
- port: "3306",
- username: "root",
- password: "",
- database: "test",
- pool: true
- },
- schema = new Schema( config.driver, config );
- module.exports = {
- caminte: caminte,
- Schema: Schema,
- config: config,
- schema: schema
- }
- var socket = require( 'socket.io' ),
- ...
- config = require( './config' ),
- models = require( './models' );
- io.on( 'connection', function (socket) {
- socket.on( "new_channel", function (data, device) {
- const channels = new models.channels.create(function(err){
- user_name: 'Peter'
- });
- console.log( channels );
- } );
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement