小编mat*_*2mi的帖子

Nodemon在重新启动时不执行exec命令

我有关于nodemon的--exec参数的问题.在这篇文章(http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/)之后,我尝试用NPM设置我的开发环境,但nodemon拒绝为我提供服务节点服务器,当我把--exec参数.

我在package.json中的脚本:

"scripts": {
    "clean": "rimraf src/app/build/app.bundle.js",
    "build": "browserify src/app/scripts/app.js > src/app/build/app.bundle.js",
    "serve": "nodemon server.js --ignore src/app/build --exec \"npm run build\"",
    "cbs": "npm run clean && npm run build && npm run open && npm run serve",

    "open:dev": "opener http://localhost:9000",
},
Run Code Online (Sandbox Code Playgroud)

这就是我在我的git bash中得到的:

poc-js-pdf@0.0.1 serve C:\Users\Mdeumie\Projets\Archi\poc-js-pdf
nodemon server.js --ignore src/app/build --exec "npm run build"

[nodemon] 1.8.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `npm run build server.js`

poc-js-pdf@0.0.1 build C:\Users\Mdeumie\Projets\Archi\poc-js-pdf
browserify src/app/scripts/app.js …
Run Code Online (Sandbox Code Playgroud)

restart exec node.js npm nodemon

3
推荐指数
1
解决办法
2454
查看次数

在 ckeditor 上为 angular 应用程序创建自定义插件

我需要为 ckeditor 创建一个自定义插件,以允许用户创建一个 cutom html a 元素。

我设法在小项目上创建了这个插件,包括我在 ckeditor 示例中的脚本元素中的代码(如下:https ://ckeditor.com/docs/ckeditor5/latest/framework/guides/tutorials/implementing-an-inline-小部件.html)。一切还好。

但我的问题是在我的 Angular 应用程序中包含该插件。我不明白如何导入它。

我尝试了许多不同的方法来导入由 webpack 生成的构建的 ckeditor.js 文件,但从未奏效...

所以我的主要问题是我不明白如何从简单的项目中使用我的插件生成构建以将其导入我的 Angular 应用程序中..

谢谢,如果有人有解决这个问题的想法??

plugins angular ckeditor5

3
推荐指数
1
解决办法
3534
查看次数

两个端口上的节点rest api和angularJS app的CORS问题

我的angularJS应用程序(在localhost:9000上)尝试捕获我的节点服务器(在localhost:9001上)时遇到了经典的CORS问题

这里我的休息api(app.js)代码:

var cors = require('cors');
app.use(cors());
app.options('*', cors());

app.all('/*', function(req, res, next) {
    // CORS headers
    res.header("Access-Control-Allow-Origin", "*"); 
    res.header('Access-Control-Allow-Methods',    'GET,PUT,POST,DELETE,OPTIONS');
    res.header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type");
    if (req.method == 'OPTIONS') {
        res.status(200);
        res.write("Allow: GET,PUT,POST,DELETE,OPTIONS");
        res.end();
    } else {
        next();
    }
});
Run Code Online (Sandbox Code Playgroud)

如你所见,我已经尝试了这些解决方案:

这是webapp中简单的$ http调用:

var req = {
    method: 'GET',
        url: 'localhost:9001/memories'
    };
    $http(req).
        success(function(data, status, headers, config) {
            // this callback will be called asynchronously
            // when the response is available
            reutrnStatus.success = true;
            reutrnStatus.msg = status;
            memories …
Run Code Online (Sandbox Code Playgroud)

api rest node.js cors angularjs

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

标签 统计

node.js ×2

angular ×1

angularjs ×1

api ×1

ckeditor5 ×1

cors ×1

exec ×1

nodemon ×1

npm ×1

plugins ×1

rest ×1

restart ×1