npm start; # 访问 http://localhost:3001/ # press ctrl + c 关闭 npm run build; # 构建 cd build; ls -al;
安装 nginx,nano
1 2 3 4
apk add nginx; # 代理服务器 apk add nano; # 字符终端的文本编辑器
nano /etc/nginx/conf.d/default.conf # 编辑代理服务器配置
default.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# This is a default site configuration which will simply return 404, preventing # chance access to any other virtualhost. server { listen 80 default_server; listen [::]:80 default_server;4 location / { root /var/www/localhost/htdocs/build; # this will make so all routes will lead to # index.html so that react handles the routes try_files $uri $uri/ /index.html; } # You may need this to prevent return 404 recursion. location = /404.html { internal; } }
let access_token_url = "https://api.github.com/?access_token=" + access_token; let headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3571.0 Safari/537.36'}; // GET request(access_token_url, {headers}, function (err, rs, userInfo) { if (err) { logger.error(err) } logger.info(userInfo); });