zoukankan      html  css  js  c++  java
  • 6月份开发问题整理

    1、静态资源服务器搭建

     1 /*加载模块*/
     2 var express = require('express');
     3 var http = require('http');
     4 var path = require('path');
     5 /*创建服务*/
     6 var app = express();
     7 app.set('port', 80);
     8 app.use(express.static(path.join(__dirname, 'public')));
     9 /*服务启动*/
    10 http.createServer(app).listen(app.get('port'), function() {
    11 console.log('静态资源服务器已启动,监听端口:' + app.get('port'));
    12 });

    2、PM2能否运行npm start

    https://stackoverflow.com/questions/31579509/can-pm2-run-an-npm-start-script

    (1) 原生支持

    pm2 start npm -- start

    (2) shell脚本

    wrote shell script below (named start.sh). Because my package.json has prestart option. So I want to run npm start.

    1 #!/bin/bash
    2 cd /path/to/project
    3 npm start

    Then, start start.sh by pm2.

    pm2 start start.sh --name appNameYouLike

    3、开发注意事项

    1)环境变量 env

    分别是 development,testing,production,对应开发,测试和线上,统一通过PHP打到js变量env中。

    可以使用这些变量来控制api的地址,比如如下:

    var api_base = (env === 'production') ? '//open.che300.com' : '//open.ceshi.che300.com';

    2)HTTP和HTTPS问题

    我们页面中的前端资源和访问的接口,都统一配置成 // 开头,来根据实际域名切换http协议。

    <script type="text/javascript" src="//fezz.che300.com/cves/wap/dist/lib/js/jquery-1.9.1.min.js?v=297"></script>

    4、How to remove a auto hyperlinked phone number from Microsoft Edge

    https://stackoverflow.com/questions/31867068/how-to-remove-a-auto-hyperlinked-phone-number-from-microsoft-edge

    The solution that works for iOS devices also works for Microsoft Edge.

    Adding the meta tag, 

    <meta name="format-detection" content="telephone=no"> 

    will prevent the DOM document from being modified when parsed by the browser.

    5、Disabling chrome autofill

    https://stackoverflow.com/questions/15738259/disabling-chrome-autofill

    autocomplete="off" 
    ---- to ----
    autocomplete="false"
  • 相关阅读:
    ES6中的find与filter的区别
    centos7上搭建http服务器以及设置目录访问
    JSON.parse()和JSON.stringify()的用法
    video 在iphone手机的ios系统和微信端无法自动播放
    JavaScript规范----DOM操作
    http与https的区别
    vw vh 的概念
    JS实现数组排序:升序和降序
    用Vue来实现音乐播放器(二十三):音乐列表
    JavaScript对象---递归遍历对象
  • 原文地址:https://www.cnblogs.com/dahe1989/p/7183747.html
Copyright © 2011-2022 走看看