Node.js相關
基本教學
0.寫一個server.js
var ip = "127.0.0.1";
var port = 1337;
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(port, ip);
console.log("Server running at http://" + ip + ":" + port);
打開CMD
1.node server.js
2.ngrok http 1337
3.瀏覽http://特定位置.ngrok.io
ngrok和nodejs port要一樣
快速建專案
https://github.com/facebookincubator/create-react-app
安裝
npm install -g create-react-app
create-react-app my-app
cd my-app/
npm start
my-app=專案名稱
預設PROT是3000,ngrok記得要改
Remarkable可裝
https://github.com/jonschlinkert/remarkable
加入 var Remarkable = require('remarkable');
jquery安裝
npm install --save jquery
import $ from 'jquery';
View的部分:React
A JavaScript library for building user interfaces - React
Framework
npm可用yarn代替 速度更快
https://yarnpkg.com/en/docs/install
React相關
React/React Native 的ES5 ES6写法对照表 | 论坛 - React Native中文社区
http://wwsun.github.io/posts/react-with-es6-part-3.html
出現問題
1.unknown prop ontouchtap on button tag
裝https://github.com/zilverline/react-tap-event-plugin
加上這兩行
import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();