http://blog.risingstack.com/fundamental-node-js-design-patterns/ https://github.com/RisingStack/node-style-guide
http://stackoverflow.com/questions/10680601/nodejs-event-loop http://www.sitepoint.com/10-tips-make-node-js-web-app-faster/
https://www.joyent.com/developers/node/design
The project is based on LoopBack.
node .
or
npm run server
slc arc
slc loopback:model
slc loopback:property
npm run build
http://docs.strongloop.com/display/public/LB/Environment-specific+configuration
User.login({username: 'foo', password: 'bar'}, function(err, accessToken) {
console.log(accessToken);
});
disable registration: user.json:
{
"principalType": "ROLE",
"principalId": "$everyone",
"permission": “DENY",
"property": "create"
},
MyModel.observe('access', function limitToTenant(ctx, next) {
ctx.query.where.tenantId = loopback.getCurrentContext().tenantId;
next();
});
https://github.com/strongloop/loopback-faq-user-management#how-do-you-register-a-new-user
https://github.com/beeman/loopback-angular-admin
https://github.com/strongloop-community/sample-applications
https://github.com/strongloop/strong-nginx-controller
https://github.com/Neil-UWA/loopback-remote-routing
https://strongloop.com/strongblog/node-js-process-manager-production/ https://strongloop.com/strongblog/node-js-deploy-production-best-practice/
slc run --cluster 2
http://habrahabr.ru/post/270391/
http://socket.io/docs/ https://github.com/makersu/loopback-example-socket.io-chat
Private user channel user:${userId}
Messages:
p:unread
unread notifications countfresh
new nails
https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-an-ubuntu-14-04-vps
> mongo
> use kontra
> db.createCollection('log')
> db.createUser({ user: "dev", pwd: "dev", roles: [{ role:"readWrite", db: "kontra"}]});
> db.createUser({ user: "staging", pwd: "staging", roles: [{ role:"readWrite", db: "kontra"}]});
http://docs.mongodb.org/manual/reference/method/db.currentOp/
db.currentOp()
db.currentOp().inprog.forEach(
function(op) {
if(op.secs_running > 5) printjson(op);
}
)
db.notification.find().snapshot().forEach( function (ntf) {
if (!ntf.data.nailId) {
ntf.data.nailId = ntf.data.entityId || null;
db.notification.save(ntf);
}
});
Create script for automigrate
-
https://developers.facebook.com/apps https://developers.facebook.com/apps/1014356928584078/dashboard/
-
https://console.developers.google.com/project https://console.developers.google.com/project/kontra-1002/apiui/credential/oauthclient/211984216216-0phr0ahr3l8kaubgbov9230ih53v1tg5.apps.googleusercontent.com
brew install redis
redis-server /usr/local/etc/redis.conf
https://github.com/RisingStack/trace-nodejs https://docs.strongloop.com/display/public/LB/Setting+debug+strings
DEBUG=loopback*,strong-remoting* npm run test
https://github.com/Automattic/kue
https://strongloop.com/strongblog/nodejs-testing-documenting-apis-mocha-acquit/ http://www.clock.co.uk/blog/tools-for-unit-testing-and-quality-assurance-in-node-js https://medium.com/@tomastrajan/proper-testing-of-angular-js-applications-with-es6-modules-8cf31113873f
nvm install 6
nvm alias default 6
nvm use default
npm install -g pm2
pm2 restart 0
https://docs.mongodb.org/manual/tutorial/transparent-huge-pages/ http://askubuntu.com/questions/643252/how-to-migrate-mongodb-2-6-to-3-0-with-wiredtiger
$ cp server/aws.json.dist server/aws.json
$ vim ..
https://strongloop.com/strongblog/best-practices-for-express-in-production-part-one-security/
Node security project:
npm i -g nsp
nsp check
RequireSafe
npm i -g requiresafe
requiresafe check
Retire
npm i -g retire
retire