在前端项目开发时,本地启动项目可能使用的地址localhost+端口,然后后端给出的api接口可能是外网的地址(例如dev.api.com),前端直接使用可能会存在跨域问题,解决方法有两种:一种是后端直接设置允许跨域,另一种是做反向代理。 前端做反向代理可以使用NGINX,也可以使用webpack-dev-server。使用webpack-dev-server做代理的配置如下:
module.exports = {
devServer: {
proxy: {
'/api': {
target: 'http://dev.api.com',
pathRewrite: {'^/api' : ''}
}
}
}
}
华为镜像源
NPM的配置文件为用户根目录下的:~/.npmrc
(Windows路径为:C:\Users\<UserName>\.npmrc
),您可以点击此处直接下载配置文件,或者运行如下命令设置:
npm config set registry https:
npm cache clean -f
华为开源镜像站同时也提供了工具类加速镜像,可以通过如下的命令设置加速地址: ※ 设置nodejs工具的镜像地址
npm config set disturl https:
直接npm i puppeteer
会报错的。
自己乱搞一波,不知道怎么安装好了。大概有以下操作:
sudo apt install snapd
- 重启设备
sudo apt install chromium-browser chromium-codecs-ffmpeg
npm i puppeteer
sudo sysctl -w kernel.unprivileged_userns_clone=1
- 重启设备
官方手动安装方法
创建配置文件
执行命令: sudo vim /etc/mongodb/mongod.conf
并添加以下内容
systemLog:
destination: file
path: /var/log/mongodb/mongod.log
logAppend: true
storage:
dbPath: /var/lib/mongo
net:
bindIp: 127.0.0.1
Export and import directives have several syntax variants.
In the previous article we saw a simple use, now let’s explore more examples.
Export before declarations
We can label any declaration as exported by placing export before it, be it a variable, function or a class.
For instance, here all exports are valid:
export let months = ['Jan', 'Feb', 'Mar','Apr', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
export const MODULES_BECAME_STANDARD_YEAR = 2015;
export class User {
constructor(name) {
this.name = name;
}
}