标签: compoundjs

保护node-webkit桌面应用程序中的源代码

首先,我见过nwsnapshot.并没有帮助.

我正在使用node-webkit构建库存管理系统作为桌面应用程序.正在构建的项目使用compoundjs(mvc javascript库).它有一个明确的文件夹结构(你知道mvc)和里面的多个javascript文件.

问题是nwsnapshot允许应用程序只有一个快照文件,但应用程序的逻辑分布在不同的javascript文件中的所有文件夹.

那么如何在将源代码发送到客户端之前保护我的源代码呢?或任何其他解决方案或更聪明的方式(是的,我知道混淆).

model-view-controller code-access-security node.js node-webkit compoundjs

16
推荐指数
1
解决办法
6630
查看次数

错误:找不到模块'jade~'

我是节点js的新手.我使用Compound Js来创建一个crud操作.

该应用程序工作正常,直到我试图提醒一个值,之后我收到了错误

500 Error: Cannot find module 'jade~'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题

我的索引

#tabs
  ul
    li
      a(href='#tabs-1') New Leave
    li
      a(href='#tabs-2') Index of Leave
  #tabs-1
    .page-header
      h1 New employee

    - var form = formFor(employee, {action: pathTo.employees(), method: 'POST', id: "employee_form", class: 'form-horizontal'})

    != form.begin()
    != errorMessagesFor(employee) 
    .control-group
      != form.label("code", false, {class: "control-label"})
      .controls
        != form.input("code")
    .control-group
     != form.label("description", false, {class: "control-label"})
      .controls
        != form.input("description")
    .control-group
      != form.label("applicable", false, {class: "control-label"}) …
Run Code Online (Sandbox Code Playgroud)

javascript node.js railway.js compoundjs pug

7
推荐指数
4
解决办法
3万
查看次数

节点js,使用connect-memcached时没有响应

嗨,我正在使用compoundjs和connect-memcached.以下是我的envirionment.js文件中的内容:

module.exports = function (compound) {

var express = require('express');
var MemcachedStore = require('connect-memcached')(express);
var app = compound.app;

require('./mongoose').init(compound);
app.configure(function(){
    app.use(compound.assetsCompiler.init());
    app.use(express.static(app.root + '/public', { maxAge: 86400000 }));
    app.set('view engine', 'ejs');
    app.set('view options', { complexNames: true });
    app.set('jsDirectory', '/javascripts/');
    app.set('cssDirectory', '/stylesheets/');
    app.set('cssEngine', 'stylus');
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(express.favicon());
    app.use(express.logger());
    app.use(express.cookieParser());
    app.use(express.session({secret: 'AuthenticationSecret', store: new           MemcachedStore}));        
    app.use(app.router);
}); };
Run Code Online (Sandbox Code Playgroud)

当我通过提供以下命令启动服务器时:

NODE_ENV=production node .
Run Code Online (Sandbox Code Playgroud)

它开始很好,我得到:

MemcachedStore initialized for servers: 127.0.0.1:11211
AssetsCompiler Precompiling assets: coffee, styl
Compound server listening on 0.0.0.0:3000 within production environment
Run Code Online (Sandbox Code Playgroud)

当我通过浏览器请求时,我没有收到任何回复. …

session memcached response node.js compoundjs

6
推荐指数
1
解决办法
908
查看次数

CompoundJS中的一对多关系

我是CompoundJS的新手,我在使用jugglingDB设置一对多关系时遇到了问题.我使用MySQL作为数据库.

我已经设置了两个模型Book和Author.

书中有很多作者.

这是我的schema.js(db/schema.js):

var Book = describe('Book', function () {
    property('title', String);
    property('isbn', String);
    property('authorId', Number);
    set('restPath', pathTo.books);
});

var Author = describe('Author', function () {
    property('name', String);
    property('authorId', Number);
    set('restPath', pathTo.authors);
});
Run Code Online (Sandbox Code Playgroud)

我把关系放在models/Book.js中.这是我的Book.js(models/Book.js):

module.exports = function (compound, Book) {
  Book.hasMany(compound.models.Author,   {as: 'author',  foreignKey: 'authorId'});
};
Run Code Online (Sandbox Code Playgroud)

这是我的Author.js(models/Author.js):

module.exports = function (compound, Author) {
 Author.belongsTo(compound.models.Book, {as: 'books', foreignKey: 'authorId'});
};
Run Code Online (Sandbox Code Playgroud)

问题是我不能创造这些关系.当我检查表时没有在表中设置外键.

我从模型Book.js和Author.js中删除关系,并将关系放在schema.js本身

之后schema.js看起来像这样:

var Book = describe('Book', function () {
    property('title', String);
    property('isbn', String); …
Run Code Online (Sandbox Code Playgroud)

node.js express railway.js compoundjs

5
推荐指数
1
解决办法
1249
查看次数

Compoundjs无法使用jugglingdb-mysql运行

试图用mysql测试compoundjs但它失败了.

我的系统是Debian 7,其中包含以下版本的nodejs和npm

$ node -v
v0.10.13

$ npm -v
1.3.4

这是我安装compoundjs的方法

sudo npm install -g compound
sudo npm install -g jugglingdb --save
sudo npm install -g jugglingdb-mysql

compound init testapp --db mysql
cd testapp
npm install
$ node server.js

WARNING: JugglingDB adapter "mysql" is not installed,
so your models would not work, to fix run:

    npm install jugglingdb-mysql


/srv/www/playground/node/testapp/node_modules/jugglingdb/lib/railway.js:55
        if (!schema.adapter) throw new Error('Adapter is not defined');
                                   ^
Error: Adapter is not defined
    at init (/srv/www/playground/node/testapp/node_modules/jugglingdb/lib/railway.js:55:36)
    at CompoundServer.initialize (/srv/www/playground/node/testapp/node_modules/jugglingdb/index.js:31:19) …

mysql node.js compoundjs jugglingdb

5
推荐指数
1
解决办法
766
查看次数

MongooseJS在预挂钩期间修改文档

我和猫鼬有一些问题.我的目标是在预保存期间,我将能够修改对象,如果需要可以分割标记,或者在另一种情况下计算子文档持续时间的总和并在主文档中更新它.

我发现如果我加载一个模型,然后调用doc.update传递新数据,只调用schema.pre('update', ...)触发器,并且this我的中间件内的任何更改都不会更新.我也尝试this.set('...', ....);在我的更新中间件中使用无济于事.

似乎我这样做doc.save(...),然后按预期附加到this内部的更改schema.pre('save', ...).除了将发布的变量扩展到我的模型的属性和保存之外,我没有看到任何方法来为此目的利用doc.update.

我的目标: - 通过以下方式更新现有文档doc.update(properties, ....) - 在保存期间使用中间件来修改文档,执行高级验证和更新相关文档 - 在更新期间使用中间件来修改文档,执行高级验证和更新相关文档 - 可互换使用模型. findByIdAndUpdate,model.save,model.findById-> doc.update,model.findById-> doc.save,并进入我的保存/更新中间件.

一些任意的示例代码:

function loadLocation(c) {
    var self = this;
    c.Location.findById(c.params.id, function(err, location) {
        c.respondTo(function(format) {
            if (err | !location) {
                format.json(function() {
                    c.send(err ? {
                        code: 500,
                        error: err
                    } : {
                        code: 404,
                        error: 'Location Not Found!'
                    });
                });
                format.html(function() {
                    c.redirect(c.path_to.admin_locations);
                });
            } else {
                self.location = …
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb node.js express compoundjs

2
推荐指数
1
解决办法
1万
查看次数