Hey anyone plz need your HELLP

hey guys i was trying one project and here i have error witch i cant find.

user.js

 
/**
* Created by Deividas on 2015-04-04.
*/
var mongoose =require('mongoose');

var userSchema  = new mongoose.Schema({
        username: {type: String, unique: true},
        password: String,

        sprite: String,

        current_room: String,
        pos_x: Number,
        pos_y: Number

    
});

userSchema.statics.register = function(username, password, cb){

    var new_user = new User({
        username: username,
        password: password,

        sprite: "spr_Hero",

        current_room: maps[config.starting_zone].room,
        pos_x: maps[config.starting_zone].start_x,
        pos_y: maps[config.starting_zone].start_y
    
});

    new_user.save(function(err) {
        if (!err) {
            cb(true);
        } else {
            cb(false);
        }
    });

};

userSchema.statics.login = function(username, password, cb){

    User.findOne({username: username}, function(err,user){

        if(!err && user){

            if (user.password == password) {
                cb(true, user);
            }else{
                cb(false, null);
            }
        }else{
            cb(false, null);
        }
    })

};

module.exports = User = gamedb.model('User', userSchema);


01_mongodb.js
 
var mongoose = require('mongoose');

module.exports = gamedb = mongoose.createConnection(config.database);



server.js
 
/**
* Created by Deividas on 2015-03-25.
*/
//Import Required Libaries
require(__dirname + '/Resources/config.js');
var fs = require('fs');
var net =require ('net');
require('./packet.js');

// Load the initalizers
var init_files
= fs.readdirSync(__dirname +"/Initializers");
init_files.forEach(function(initFile){
    console.log('Loading Initializer:' + iniFile);
    require(__dirname + "/Initializers/" + iniFile);
});
// Load the models
var model_files
= fs.readdirSync(__dirname +"/Models");
model_files.forEach(function(modelFile){
    console.log('Loading Model:' + modelFile);
    require(__dirname + "/Models/" + modelFile);
});
// Load maps
maps
= {};
var map_files = fs.readdirSync(config.data_paths.maps);
map_files.forEach(function(mapFile){
    console.log('Loading Map:' + mapFile);
    var map = require(config.data_paths.maps + mapFile);
    maps[map.room] = map
});

net.createServer(function(socket){

    console.log("socket connected");
    var c_inst = new require('./client.js');
    var thisClient = new c_inst();

    thisClient.socket = socket;
    thisClient.initiate();

    socket.on('error', thisClient.error);

    socket.on('end', thisClient.end);

    socket.on('data', thisClient.data);

}).listen(config.port);

console.log("Initialize Completed, Server running on port: " +config.port +" for enviroment: " + config.environment);


and  here is err

c:\Users\...\server.js:13
    console.log('Loading Initializer:' + iniFile);
                                         ^
ReferenceError: iniFile is not defined
    at c:\Users\...\server.js:13:42
    at Array.forEach (native)
    at Object.<anonymous> (c:\Users\...\server.js:12:12)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

P.S. srry for my horrable english. Anyone plz hellp

1 comment
Comment actions Permalink

solved by myself

0

Please sign in to leave a comment.