{"id":188630,"date":"2013-08-01T15:54:03","date_gmt":"2013-08-01T11:54:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=188630"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=188630","title":{"rendered":"<span class=\"post_title\">NodeJS \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439, \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0439, \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0439 \u0438\u043b\u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0442\u0430\u043a\u0438\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e redis \u0438 nohm<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 IT-\u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0448\u0443\u043c\u0438\u0445\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e JavaScript, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u2014 NodeJS, \u043e\u0434\u043d\u0430\u043a\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0439, \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0439 \u043a\u043e\u0434. \u0427\u0442\u043e \u044f \u0438\u043c\u0435\u044e \u0432\u0432\u0438\u0434\u0443? \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441 js \u044f \u0437\u043d\u0430\u043a\u043e\u043c \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e, \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043f\u0438\u0441\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Java, \u0430 \u0432 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0438\u0448\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043e\u043d\u043b\u0430\u0439\u043d-\u0438\u0433\u0440\u044b \u043d\u0430 PHP \u0438, \u043a\u0430\u043a \u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u043e \u043e\u0436\u0438\u0434\u0430\u0442\u044c, \u043a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u0438\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c \u043d\u0430 JS \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435, JavaScript \u0432\u043d\u043e\u0441\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u044b \u0434\u0430\u0436\u0435 \u0432 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 Object.prototype \u0438 __proto__. \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u043c\u043d\u0435 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443, \u043a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u0438\u043c \u0434\u0440\u0443\u0433\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u2014 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u00ab\u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e \u041e\u041e\u041f\u00bb, \u0441\u0434\u0435\u043b\u0430\u043b. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0432 \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0437\u0430\u0447\u0435\u043c, \u0435\u0441\u043b\u0438 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 nodeJS. \u0417\u0430 \u043c\u043e\u044e, \u0445\u043e\u0442\u044c \u0438 \u043d\u0435\u0434\u043e\u043b\u0433\u0443\u044e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0443, \u043c\u043d\u0435 \u043d\u0435 \u0434\u043e\u0432\u0435\u043b\u043e\u0441\u044c \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0430 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u041e\u041e \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u044f \u0438\u043c\u0435\u044e \u0432\u0432\u0438\u0434\u0443 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430 \u0438 \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u0438 (\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u0441\u0435 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u043d\u043e \u0432 \u0442\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e js \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442). <br \/>  <a name=\"habracut\"><\/a><br \/>  \u0418\u0437\u0443\u0447\u0438\u0432 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 nodeJS, \u044f \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d MVC \u0442\u0430\u043a, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 PHP-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432, \u0445\u043e\u0442\u044f, \u044d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u044b \u043d\u0430 \u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435(\u043a\u0430\u043a \u044f \u0434\u0443\u043c\u0430\u043b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0435) \u043f\u0440\u0438\u043d\u0435\u0441\u0443\u0442 \u0441\u0432\u043e\u0438 \u043f\u043b\u043e\u0434\u044b.<\/p>\n<p>  \u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442<br \/>  \u041f\u0435\u0440\u0435\u0434\u043e \u043c\u043d\u043e\u0439 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u2014 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u00ab\u0438\u0433\u0440\u043e\u0432\u044b\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u044b\u00bb \u043d\u0430 node.js, \u043a\u0430\u0437\u043b\u043e\u0441\u044c \u0431\u044b \u2014 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u041c\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043e\u0442 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u044d\u0442\u0438\u043c \u0440\u0430\u043d\u044c\u0448\u0435. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0411\u0414 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Redis. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<br \/>  -root<br \/>   &#8212;application.js<br \/>   &#8212;config.js<br \/>   &#8212;constants.js<br \/>   &#8212;import_data.js<br \/>   &#8212;slots_module.js<br \/>   &#8212;user_activity.js<br \/>   &#8212;social.js<br \/>   &#8212;modules\/<br \/>   &#8212;\u0442\u0443\u0442 \u043b\u0435\u0436\u0430\u0442 \u043c\u043e\u0434\u0443\u043b\u0438 \u0434\u043b\u044f node.js<\/p>\n<p>  \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f \u0434\u043b\u044f \u043d\u043e\u0434\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438? :=)<\/p>\n<p>  \u041d\u043e \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u0441\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430, \u043a\u0430\u043a \u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u043e \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u044d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u0442\u0440\u0443\u0434\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c. Application \u0438 config \u0440\u0430\u0437\u0440\u043e\u0441\u043b\u0438\u0441\u044c \u043d\u0430 5000 \u0441\u0442\u0440\u043e\u043a \u043a\u0430\u0436\u0434\u044b\u0439, \u0441\u0442\u0430\u043b\u043e \u043c\u043d\u043e\u0433\u043e \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u0438, \u0441\u0442\u0430\u043b\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0433\u0434\u0435 \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f, \u043d\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443.<\/p>\n<p>  \u0418 \u0432\u043e\u0442, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u0433\u043b\u0430\u0432\u043d\u043e\u043c\u0443. \u041d\u0430\u043a\u0438\u043f\u0435\u043b\u043e. \u042f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0430\u043f\u0438\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u0438 \u0440\u0435\u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u0435\u0440\u0432\u043e\u043c \u0434\u0435\u043b\u043e\u043c, \u044f \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043b \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043a\u0430\u043a Object Relational Mapping(ORM) \u0438 \u043a \u043c\u043e\u0435\u043c\u0443 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u044e \u044f \u043d\u0430\u0448\u0435\u043b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e ORM \u0434\u043b\u044f NodeJS \u0438 Redis. \u042d\u0442\u043e \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u043b\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u043c \u0442\u043e\u043b\u0447\u043a\u043e\u043c \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0439 \u043c\u043d\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b. \u041c\u043e\u0434\u0443\u043b\u044c nohm \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438, \u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043a\u043e\u0434, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u043c. \u0412\u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (User.js)  <\/p>\n<pre><code class=\"javascript\">\/**  * User: hlogeon  * Date: 31.07.13  * Time: 23:36  * TODO: continue creating this  * read http:\/\/maritz.github.io\/nohm\/  *\/  var nohm = require('nohm').Nohm; var redis = require('redis').createClient();  nohm.setClient(redis);   nohm.model('User', {     properties: {                 balance: {                          type: &quot;integer&quot;,                          defaultValue: 0,                          index: false                 },                  ad_id: {                        type: &quot;string&quot;,                        index: true                 },                 bonus_games_pending: {                                      type: &quot;boolean&quot;,                                      index: false                 },                 chips: {                        type: &quot;integer&quot;,                        defaultValue: 0                 },                 source: {                         type: &quot;string&quot;                 },                 spins_count: {                              type: &quot;integer&quot;,                              defaultValue: 0                 },                 mute: {                       type: &quot;boolean&quot;,                       defaultValue: false                 },                 sound: {                        type: &quot;boolean&quot;,                        defaultValue: false                 },                 charges_base: {                               type: &quot;boolean&quot;,                               defaultValue: false                 },                 parent_ref: {                            type: &quot;string&quot;,                             index: true                 },                 sid: {                      type: &quot;string&quot;,                      index: true                 },                 bonus_to: {                           type: &quot;integer&quot;,                           defaultValue: 0                 },                 points_count: {                               type: &quot;integer&quot;                 },                 parent_id:{                           type: &quot;string&quot;,                           index: true                  },                 invitation_accepted: {                                      type: &quot;string&quot;                 },                 ref_type: {                           type: &quot;string&quot;,                           index: true                  },                 spins_temporary: {                                  type: &quot;integer&quot;                 },                 enter_date: {                             type: &quot;integer&quot;                 },                 free_spins: {                             type: &quot;integer&quot;                 },                 screen: {                         type: &quot;string&quot;                 },                 last_game: {                            type: &quot;string&quot;                 },                 startOffer: {                             type: &quot;boolean&quot;,                             index: true                 },                 last_activity: {                                type: &quot;integer&quot;                 },                 win_turn: {                           type: &quot;integer&quot;                 },                 double_game_pending: {                                      type: &quot;integer&quot;                 },                 level: {                        type: &quot;integer&quot;,                        index: true                 },                 last_spin: {                             type: &quot;integer&quot;                 },                 uid: {                     type: &quot;string&quot;,                      index: true                 },                 status: {                         type: &quot;string&quot;                 },                 bonus_games_temporary: {                                        type: &quot;integer&quot;,                                        defaultValue: 0                 },                 browser: {                          type: &quot;string&quot;                 },                 builded: {                     type: string,                 }     },     methods: {             getContryFlag: function () {                 return 'http:\/\/example.com\/flag_'+this.p('country')+'.png';             },             updateBalance: function (value){                 var balance = this.p('balance');                 this.p('balance', balance+value);                 this.save();             },             updateChips: function(value){                 var chips = this.p(&quot;chips&quot;);                 this.p(&quot;chips&quot;, chips+value);                 this.save();             },              incrSpins: function(){                  var spins = this.p('spins_count');                  this.p('spins_count', spins+1);                  this.save();              },              swichMute: function(){                  var mute = this.p('mute');                  this.p('mute', !mute);                  this.save();              },             swichSound: function(){                 var sound = this.p('sound');                 this.p('sound', !sound);                 this.save();             },             setPointsCount: function (value){                 this.p('points_count', value);                 this.save();                 return value;             },             incrPointsCount: function(){                 var count = this.p('points_count');                 this.p('points_count', count+1);                 this.save();             },             incrSpinsTmp: function(){                 var tmp = this.p('spins_temporary');                 this.p('spins_temporary', tmp+1);                 this.save();             },             incrFreeSpins: function(){                 var spins = this.p('free_spins');                 this.p('free_spins', spins+1);                 this.save();             },             incrLevel: function(){                 var level = this.p('level');                 this.p('level', level+1);                 this.save();                 return this.p('level');             }      } });  var user = nohm.factory('User');  exports.user = user;    <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">var user = require('.\/UserTest').user;  app.get('\/', function (req, res) {      var activeUser = nohm.factory('User');     activeUser.save(function(errs){         if(errs){             res.json(errs);         }         else{             res.json(activeUser.allProperties());         }     });       app.get('\/findUser', function (req, res) {         var id = req.body.id;         user.load(id, function(err, aUser){             if(err){                 res.json(err);             }             else{                 res.json(aUser.allProperties);             }         })          });   <\/code><\/pre>\n<p>  \u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u044d\u0442\u043e \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0449\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0445 redis.hgetall() \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0434\u0430\u0436\u0435 \u0421\u0432\u044f\u0437\u0438(Relations).<\/p>\n<p>  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0430\u043a\u043e\u043c\u0443 \u043f\u043e\u0434\u0445\u043e\u0434\u0443 \u044f \u0440\u0430\u0437\u0431\u0438\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u0438 \u0438 \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<br \/>  -root<br \/>   &#8212;application.js<br \/>   &#8212;constants.js<br \/>   &#8212;config.js<br \/>   &#8212;models\/<br \/>   &#8212;User.js<br \/>   &#8212;Slotmachine.js<br \/>   &#8212;Event.js<br \/>   &#8212;helpers\/<br \/>   &#8212;Social.js<\/p>\n<p>  \u0425\u043e\u0442\u044c \u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u0442\u0430\u043b\u043e \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0437\u0430\u0442\u043e, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043a\u043e\u0434\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u043e\u0441\u044c, \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043d\u0438\u0437\u0438\u043b\u043e\u0441\u044c, \u0430 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u0440\u043e\u0441\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e! \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043d\u0435 \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0441\u043f\u0443\u0442\u044b\u0432\u0430\u0442\u044c \u043b\u0430\u043f\u0448\u0443 \u0438\u0437 callback-\u0444\u0443\u043d\u043a\u0446\u0438\u0439 10 \u0443\u0440\u043e\u0432\u043d\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0412\u0441\u0435 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e, \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043a\u043e\u043c\u0443-\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u044d\u0442\u0430 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0441\u0442\u0430\u0442\u0435\u0439\u043a\u0430 \u043e\u0442 \u043d\u043e\u0432\u0438\u0447\u043a\u0430 \u0432 nodejs. \u042f \u0431\u0443\u0434\u0443 \u043e\u0447\u0435\u043d\u044c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d \u0437\u0430 \u043a\u0440\u0438\u0442\u0438\u043a\u0443!    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/188630\/\"> http:\/\/habrahabr.ru\/post\/188630\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 IT-\u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0448\u0443\u043c\u0438\u0445\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e JavaScript, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u2014 NodeJS, \u043e\u0434\u043d\u0430\u043a\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0439, \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0439 \u043a\u043e\u0434. \u0427\u0442\u043e \u044f \u0438\u043c\u0435\u044e \u0432\u0432\u0438\u0434\u0443? \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441 js \u044f \u0437\u043d\u0430\u043a\u043e\u043c \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e, \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043f\u0438\u0441\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Java, \u0430 \u0432 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0438\u0448\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043e\u043d\u043b\u0430\u0439\u043d-\u0438\u0433\u0440\u044b \u043d\u0430 PHP \u0438, \u043a\u0430\u043a \u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u043e \u043e\u0436\u0438\u0434\u0430\u0442\u044c, \u043a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u0438\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c \u043d\u0430 JS \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435, JavaScript \u0432\u043d\u043e\u0441\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u044b \u0434\u0430\u0436\u0435 \u0432 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 Object.prototype \u0438 __proto__. \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u043c\u043d\u0435 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443, \u043a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u0438\u043c \u0434\u0440\u0443\u0433\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u2014 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u00ab\u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e \u041e\u041e\u041f\u00bb, \u0441\u0434\u0435\u043b\u0430\u043b. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0432 \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0437\u0430\u0447\u0435\u043c, \u0435\u0441\u043b\u0438 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 nodeJS. \u0417\u0430 \u043c\u043e\u044e, \u0445\u043e\u0442\u044c \u0438 \u043d\u0435\u0434\u043e\u043b\u0433\u0443\u044e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0443, \u043c\u043d\u0435 \u043d\u0435 \u0434\u043e\u0432\u0435\u043b\u043e\u0441\u044c \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0430 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u041e\u041e \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u044f \u0438\u043c\u0435\u044e \u0432\u0432\u0438\u0434\u0443 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430 \u0438 \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u0438 (\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u0441\u0435 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u043d\u043e \u0432 \u0442\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e js \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442).   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-188630","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/188630","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=188630"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/188630\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=188630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=188630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=188630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}