22. Node Knock Out 2012
Advance Authentication
加入Passport認證機制
23. Passport authentication with Google
# git clone https://github.com/jaredhanson/passport-google.git
# cd ~/project/passport-google/examples/signon/
# npm install
# vi app.js (置換localhost成為你的server ip位置)
# node app.js
Now, you can browse: http://localhost:3000/login
30. MySQL table 準備 1/2
# mysql -uroot -p
mysql> create database nko2012 ;
Query OK, 1 row affected (0.00 sec)
mysql> use nko2012
mysql> create user 'nko'@'%' identified by 'nko2012';
mysql> grant all on *.* to 'nko'@'%';
Tips:
如欲設定mysql對外,請將
/opt/local/etc/my.cnf中的
binding-address設定成欲開放
連線的ip位置
41. Routing Configure
/* for list all product */ # app.js
app.get('/products', dbroutes.getProducts);
/* for list one product using product id*/
app.get('/products/:id', dbroutes.getProductById); [GET] for query data...
/* for delete one product record */
app.del('/products/:id', dbroutes.delProductById);
/* for create one product */
app.post('/products', dbroutes.createProduct);
[DELETE] for delete data...
/* for update one record */
app.put('/products', dbroutes.updateProductAmountById);
[POST] for create data...
[PUT] for update data...