Proxy configuration:

When we have already fews applications running in the workspace, and we want to add 'api' layer for one applicatrion only, we can use tag

ng g @nrwl/nest:app api --frontendProject=todos

This will only allow 'todos' app to access 'api'.

You passed --frontendProject=todos when creating the node application. What did that argument do?

It created a proxy configuration that allows the Angular application to talk to the API in development.

To see how it works, open angular.json and find the serve target of the todos app.

{
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "todos:build",
"proxyConfig": "apps/todos/proxy.conf.json"
},
"configurations": {
"production": {
"browserTarget": "todos:build:production"
}
}
}
}

Note the proxyConfig property.

Now open proxy.conf.json:

{
"/api": {
"target": "http://localhost:3333",
"secure": false
}
}

This configuration tells ng serve to forward all requests starting with /api to the process listening on port 3333.

Expose the common compoennts from library:

Sometimes, when we create library, we might forget to expose the component, this might lead to few minutes debuggin. To avoid that we can use --export tag

ng g component todos --project=ui --export

Running the tests:

Run npm run affected:apps, and you should see todos printed out. The affected:apps looks at what you have changed and uses the dependency graph to figure out which apps can be affected by this change.

Run npm run affected:libs, and you should see ui printed out. This command works similarly, but instead of printing the affected apps, it prints the affected libs.

Running the tests which failed previously:

npm run affected:test -- --only-failed

Running tests in parallel to speed up:

Some changes affect many projects in the repository. To speed up the testing of this change, pass --parallel.

npm run affected:test -- --parallel

About create NPM module in workspace:

check the source: https://nx.dev/fundamentals/develop-like-google

By default, libraries are only buildable in the context of an application.

To be able to build a library independently, you can pass --publishable when creating it. You can then run ng build mylib to build it, and then publish the results to an NPM registry.

[Nx] Note for learning Nx的更多相关文章

  1. NX二次开发-NX+VS写代码设断点调试技巧

    在做NX二次开发的时候写完代码,编译可以通过,但是执行的时候却没有反应,或者得到的结果不对,说明肯定有地方传值出错了.我在查找代码错误的时候有几种方法:1.uc1601打印函数输入和输出的值看对不对. ...

  2. NX二次开发-bat脚本文件切换NX的环境变量(NX路径和语言)

    路径环境变量切换到NX9.bat @echo off setx /M UGII_BASE_DIR "D:\Program Files\Siemens\NX 9.0" ------- ...

  3. NX二次开发-NX访问SqlServer数据库(增删改查)C#版

    版本:NX9+VS2012+SqlServer2008r2 以前我写过一个NX访问MySQL数据库(增删改查)的文章https://www.cnblogs.com/nxopen2018/p/12297 ...

  4. NX二次开发-NX访问MySQL数据库(增删改查)

    版本:NX11+VS2013+MySQL5.6(x64)+SQLyog 1.新建一个NX项目(多字节) 2.设置VC++目录(调用MySQL的头文件,dll和lib库文件) 3.设置番茄助手 然后重启 ...

  5. C++ (C#)实现获取NX PART预览图

    VS环境下 C++版本: 1 int GetPreviewImage(const TCHAR* prtFile, const TCHAR* imageFile) 2 { 3 IStorage* pSt ...

  6. NX二次开发-自定义添加右键菜单RegisterConfigureContextMenuCallback

    首先声明这个知识我以前不知道,是夏天的时候看到别人在唐工的QQ群里问的,唐工说西门子官方有这个例子.那个时候我因为在忙其他事情,也就没去研究那个右键菜单到底是怎么做的.关于自定义添加右键菜单Regis ...

  7. 【NX二次开发】图标图像

    用户定义位图的目录位置的环境变量 UGII_BITMAP_PATH 在NX日志中查看NX图标需要设置的变量 变量名:PRINT_DIALOG_BITMAP_NAMES 变量值:1 查看系统图标的方法1 ...

  8. 使用.NET(C#或VB.NET)开发NX外部程序

    1.如何不用将exe程序拷贝到UGII目录下运行? 答:在调用NX Open命令函数前,将当前目录移动到NX安装目录\UGII\,NX安装目录必须和环境变量UGII_BASE_DIR的值一致,否则报错 ...

  9. A brief introduction to weakly supervised learning(简要介绍弱监督学习)

    by 南大周志华 摘要 监督学习技术通过学习大量训练数据来构建预测模型,其中每个训练样本都有其对应的真值输出.尽管现有的技术已经取得了巨大的成功,但值得注意的是,由于数据标注过程的高成本,很多任务很难 ...

随机推荐

  1. SQL Server事务(二)

    事务的四大特性: 1.原子性:原子性是指事务包含的所有操作要么全部成功,要么全部失败回滚,这和前面两篇博客介绍事务的功能是一样的概念,因此事务的操作如果成功就必须要完全应用到数据库,如果操作失败则不能 ...

  2. 用命令将本地项目上传到git

    1.(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库 git init 2.把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点 ...

  3. Android Monkey压测命令

    测试步骤:1.安装ADB2.连接被测手机和电脑3.打开CMD命令行4.输入monkey命令adb shell monkey -p your.package.name --pct-touch 30 -- ...

  4. opencv实现人脸识别(二) 人脸图像采集模块

    这一步我们开始搭建第一个模块,用来检测到图像中的人脸位置,并将它拍下来保存在指定路径 流程图: 代码实现: import cv2 def pic(cam): # 调用笔记本内置摄像头,所以参数为0,如 ...

  5. Python 闭包、迭代器、生成器、装饰器

    Python 闭包.迭代器.生成器.装饰器 一.闭包 闭包:闭包就是内层函数对外层函数局部变量的引用. def func(): a = "哈哈" def func2(): prin ...

  6. 什么是Sprint?

    Sprint指Scrum团队完成一定数量工作所需的短暂.固定的周期.Sprint是Scrum和敏捷的核心,找到正确的Sprint周期将帮助您的敏捷团队交付更高质量的产品. “在Scrum框架中,庞大且 ...

  7. 【原创】大叔经验分享(77)openresty(nginx+lua)发http请求

    openresty(nginx+lua)发http请求 利用location+proxy_pass间接实现 location ^~ /test/http { internal; proxy_pass ...

  8. 5.Servlet 对象(request-response)

    /*ServletResponse*/ /*responese常见应用*/ 1.向客户端输出中文数据 (分别以OutputStream 和 PrintWriter输出) 2.文件下载和中文文件的下载 ...

  9. PCQQ - 发送自定义的XML卡片消息

    效果: 原理: qq分享产生的xml卡片消息存储在qq内存中,可以在qq运行内存中搜索找到其xml源码,记录源码相应的内存地址,通过内存地址修改掉内存数据,再次转发这条分享的消息就会发现内容的变化. ...

  10. Dart运算符与语句格式

    算术运算符 + 加 - 减 * 乘 / 除 ~/ 取整 % 取余 关系运算符 == 是否等于 != 是否不等于 > 是否大于 < 是否小于 >= 是否大于等于 <= 是否小于等 ...