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"
  • 相关阅读:
    【随手记】常用16进制代表的容量或位置
    精通css——position属性
    Ubuntu安装GitLab
    Linux内核
    分布式(一)——分布式系统的特性
    【树莓派】入门
    Intel CPU发展历史
    C++读mnist数据
    实验代码一:用来链表实现单向图
    Hadoop配置+centos6.5
  • 原文地址:https://www.cnblogs.com/dahe1989/p/7183747.html
Copyright © 2011-2022 走看看