[Nx] Note for learning Nx
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
--publishablewhen creating it. You can then runng build mylibto build it, and then publish the results to an NPM registry.
[Nx] Note for learning Nx的更多相关文章
- NX二次开发-NX+VS写代码设断点调试技巧
在做NX二次开发的时候写完代码,编译可以通过,但是执行的时候却没有反应,或者得到的结果不对,说明肯定有地方传值出错了.我在查找代码错误的时候有几种方法:1.uc1601打印函数输入和输出的值看对不对. ...
- NX二次开发-bat脚本文件切换NX的环境变量(NX路径和语言)
路径环境变量切换到NX9.bat @echo off setx /M UGII_BASE_DIR "D:\Program Files\Siemens\NX 9.0" ------- ...
- NX二次开发-NX访问SqlServer数据库(增删改查)C#版
版本:NX9+VS2012+SqlServer2008r2 以前我写过一个NX访问MySQL数据库(增删改查)的文章https://www.cnblogs.com/nxopen2018/p/12297 ...
- NX二次开发-NX访问MySQL数据库(增删改查)
版本:NX11+VS2013+MySQL5.6(x64)+SQLyog 1.新建一个NX项目(多字节) 2.设置VC++目录(调用MySQL的头文件,dll和lib库文件) 3.设置番茄助手 然后重启 ...
- C++ (C#)实现获取NX PART预览图
VS环境下 C++版本: 1 int GetPreviewImage(const TCHAR* prtFile, const TCHAR* imageFile) 2 { 3 IStorage* pSt ...
- NX二次开发-自定义添加右键菜单RegisterConfigureContextMenuCallback
首先声明这个知识我以前不知道,是夏天的时候看到别人在唐工的QQ群里问的,唐工说西门子官方有这个例子.那个时候我因为在忙其他事情,也就没去研究那个右键菜单到底是怎么做的.关于自定义添加右键菜单Regis ...
- 【NX二次开发】图标图像
用户定义位图的目录位置的环境变量 UGII_BITMAP_PATH 在NX日志中查看NX图标需要设置的变量 变量名:PRINT_DIALOG_BITMAP_NAMES 变量值:1 查看系统图标的方法1 ...
- 使用.NET(C#或VB.NET)开发NX外部程序
1.如何不用将exe程序拷贝到UGII目录下运行? 答:在调用NX Open命令函数前,将当前目录移动到NX安装目录\UGII\,NX安装目录必须和环境变量UGII_BASE_DIR的值一致,否则报错 ...
- A brief introduction to weakly supervised learning(简要介绍弱监督学习)
by 南大周志华 摘要 监督学习技术通过学习大量训练数据来构建预测模型,其中每个训练样本都有其对应的真值输出.尽管现有的技术已经取得了巨大的成功,但值得注意的是,由于数据标注过程的高成本,很多任务很难 ...
随机推荐
- oracle 创建新用户,授权dba
1.用有dba权限的用户登录:sys用户 2.创建一个新用户:create user abc identified by 123456; 3.授予DBA权限: grant connect,resour ...
- AlertManager 部署及使用
熟悉了 Grafana 的报警功能,但是 Grafana 的报警功能目前还比较弱,只支持 Graph 的图表的报警.今天来给大家介绍一个功能更加强大的报警工具:AlertManager. 简介 之前我 ...
- Educational Codeforces Round 71 (Rated for Div. 2) Solution
A. There Are Two Types Of Burgers 题意: 给一些面包,鸡肉,牛肉,你可以做成鸡肉汉堡或者牛肉汉堡并卖掉 一个鸡肉汉堡需要两个面包和一个鸡肉,牛肉汉堡需要两个面包和一个 ...
- HTTP的请求方法
. OPTIONS - 获取服务器支持的HTTP请求方法: 用来检查服务器的性能.如:AJAX进行跨域请求时的预检,需要向另外一个域名的资源发送一个HTTP O ...
- windows phone 下拉刷新
在windows phone 中采用数据列表时为了保证用户体验常遇到加载数据的问题.这个问题普遍到只要你用到数据列表就要早晚面对这个问题. 很多人会说这个问题已经有解决方案. 其实真正问题并不在于如何 ...
- kubernetes 集群内部访问外部的数据库endpoint
k8s访问集群外独立的服务最好的方式是采用Endpoint方式,以mysql服务为例: 创建mysql-service.yaml apiVersion: v1 kind: Service metada ...
- 简单SQL注入试探、一
DVWA——简单SQL注入小记 前不久刚开始接触SQL注入,今天来记录一些最近的一些收获和一些SQL注入方面的知识. 主要是基于DVWA这个开源的平台来进行练习. 废话不多说开始解题. 从简单的SQL ...
- Spring注解实践
原文:http://blog.csdn.net/xyh820/article/details/7303330 概述 注释配置相对于 XML 配置具有很多的优势: 它可以充分利用 Java 的反射机制获 ...
- CHD-5.3.6集群上Flume的文件监控
收集hive的log hive的运行日志: /home/hadoop/CDH5.3.6/hive-0.13.1-cdh5.3.6/log/hive.log * memory *hdfs ...
- WPF - 仿QQ2014
声明:非原创.项目是网上发现的,以学习为目的重写了部分代码,合理地调整了下布局,巧妙地简化了下Style样式.重写还算是有价值的,并非完全复制. 效果: 获取项目源码:https://pan.baid ...