Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
gozy
Advanced tools
Readme
Go crazy
npm install -g gozy
cd NewProject
gozy init
node .
var http = require('http').createServer().listen(80),
gozy = require('gozy');
gozy.bindModels('application/model/')
.bindControllers('application/controller')
.bindMongo('MyMongoDB', {
'host': 'localhost',
'port': 27017,
"username": "username",
"password": "password",
"database": "database"
})
.bindRedis('MyRedis', {
'host': 'localhost',
'port': 6379,
"password": "password"
})
.bindMySQL('MyMySQL', {
'host': 'localhost',
'port': 3306,
"username": "username",
"password": "password",
"database": "database"
})
.bindMailer('MyMailer', { /* this option is used for nodemailer package option */
'host': 'smtp.host.com',
secureConnection: false,
port: 587,
auth: {
user: 'sender@mail.me',
pass: 'password!!'
}
})
.enableWebSocket()
.listen(http);
require('gozy').View(this, {
'accept-url': /^\/path\/to\/resource$/,
'accept-method': 'GET'
});
this.on('initialize', function () {
});
this.on('prerequest', function (request, response, done) {
return done({ authentication: true });
});
this.on('*/*', function (request, response, preq_args) {
if(preq_args.authentication)
return response.OK().commit();
else
return response.Forbidden().commit();
});
require('gozy').Model(this, 'MyMongoDB', {
defaults: {
Name: null,
Mode: 0
}
});
this.on('initialize', function (model) {
model.prototype.setName = setName;
});
require('gozy').Model(this, 'MyMySQL', {
schema: {
id: { Id: true, type: 'INTEGER' },
Name: { type: 'STRING' },
Password: { type: 'BINARY' },
DateLastUpdated: { type: 'TIMESTAMP' }
}
});
this.on('initialize', function (model) {
model.prototype.setName = setName;
});
require('gozy').Model(this, 'MyRedis', {
type: 'STRING',
defaults: {
Name: { type: 'OBJECT' }
}
});
this.on('initialize', function (model) {
});
exports.createNew = function (cb) {
var model = exports.MyStringModel({ name: { prop1: 'value1 will be converted to JSON', prop2: 'value2 will be converted to JSON' });
model.key('this_is_Redis_key');
model.setnx(function (err, saved) {
if(err) return cb(err);
if(saved > 0) return cb(null, model);
else return cb(null, null);
});
};
require('gozy').Model(this, 'MyRedis', {
type: 'HASH',
defaults: {
Name: { type: 'STRING' }
Value: { type: 'INTEGER' }
}
});
this.on('initialize', function (model) {
});
exports.createNew = function (cb) {
var model = exports.MyHashModel({
Name: 'value1',
Value: 11
});
model.key('this_is_the_key');
/* will store on redis as a key, "MyHashModel.this_is_the_key" */
model.hmset(function (err) {
if(err) return cb(err);
console.log(model);
return cb(null, model);
});
};
exports.findModel = function (key, cb) {
exports.hgetall(key, cb);
};
require('gozy').Mailer(this, 'MyMailer', {
template: 'application/server/mailer/templates/MailTemplate.html', /* used for underscore's template function */
from: 'sender@mail.me'
});
this.on('initialize', function () {
});
this.on('mail', function (body, template_params, send) {
console.log(body, template_params);
send(template_params.ReceiverMail, template_params.SenderMail + ' welcomes you', body);
});
require('gozy').View(this, {
template: {
'ko-kr': 'application/view/templates/TemplateA.ko-kr.html',
'en-us': 'application/view/templates/TemplateB.en-us.html'
},
default_template: 'ko-kr'
});
this.on('initialize', function () {
});
require('gozy').View(this, {
content: content,
mime: 'application/json'
});
function content(args) {
return JSON.stringify(args);
}
require('gozy').View(this, {
'accept-url': /^\/path$/,
'accept-method': 'GET',
'content': content,
'mime': 'application/json',
'backbone': {
Type: 'model',
RequireJS: true,
ModelOptions: {
idAttribute: 'id'
}
}
});
function content(args) {
return JSON.stringify(args);
}
Note, you can override Backbone Collection's parse function
require('gozy').View(this, {
'accept-url': /^\/path$/,
'accept-method': 'GET',
'content': content,
'mime': 'application/json',
'backbone': {
parse: function (response) {
this.next_search_url = response.next_search_url;
return response.data;
},
Type: 'collection',
RequireJS: true,
ModelOptions: {
idAttribute: 'id'
}
}
});
function content(args) {
return JSON.stringify(args);
}
require('gozy').View(this, {
'accept-url': /^\/path\/f$/,
'accept-method': 'GET',
'content': content,
'mime': 'application/json',
'backbone': {
Type: 'collection',
RequireJS: true,
ModelOptions: {
idAttribute: 'id'
},
CollectionOptions: {
parse: function (response) {
this.NextSearchUrl = response.next_search_url;
return response.data;
},
AcceptRMI: ['rmi_test']
}
}
});
this.on('rmi_test', function (request, response) {
return response('My Request is successfully completed');
});
function content(args) {
return JSON.stringify(args);
}
MIT License
FAQs
go crazy
The npm package gozy receives a total of 3 weekly downloads. As such, gozy popularity was classified as not popular.
We found that gozy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.