準(zhǔn)備工作
方便后續(xù)軟件安裝逼龟,先改變目錄權(quán)限
sudo chown -R $(whoami) /usr/local
brew
mac上包管理神器
brew search nginx #搜索軟件
brew install nginx #安裝軟件
brew uninstall nginx #卸載軟件
brew info nginx #查詢安裝位置
brew list #查詢安裝清單
sudo brew update #升級(jí)brew
Nginx
安裝
brew install nginx
常用命令
sudo brew services start nginx
sudo brew services stop nginx
nginx -s reload
nginx -s stop
Python
安裝
brew install python
由于mac也自帶python,為了直接啟動(dòng)自己的奕短,配置一下
vi ~/.bash_profile
alias python="/usr/local/bin/python2.7"
安裝常用模塊
pip2.7 install django==1.3
pip2.7 install peewee==2.6.4
pip2.7 install protobuf
pip2.7 install pyyaml
pip2.7 install msgpack-python
pip2.7 install raven
pip2.7 install filelock
pip2.7 install redis
pip2.7 install ujson
pip2.7 install thrift
pip2.7 install grpcio
MySQL
安裝
brew install mysql
啟動(dòng)
brew services start mysql
修改密碼
USE mysql;
UPDATE user SET authentication_string=PASSWORD("1111") WHERE User='root';
FLUSH PRIVILEGES; #刷新MySQL的系統(tǒng)權(quán)限相關(guān)表-
NodeJS
安裝
brew install node
xnpm配置(以bnpm為例)
$echo '\n#alias for bnpm\nalias bnpm="npm --registry=http://npm.byted.org/\
--cache=$HOME/.npm/.cache/bnpm\
--userconfig=$HOME/.bnpmrc"' >> ~/.zshrc &&source~/.zshrc
安裝框架(以QuickSilver為例)
npm init -f
bnpm install byted-quicksilver --save?
npm --registry=http://npm.byted.org/installbyted-quicksilver --save ?#如果沒(méi)裝bnpm
運(yùn)行
1翎碑、通過(guò)./index.js可以啟動(dòng)工程之斯。在本機(jī)運(yùn)行時(shí),將默認(rèn)以開(kāi)發(fā)模式運(yùn)行莉擒,自動(dòng)啟用watch功能。當(dāng)src目錄的文件發(fā)生變化時(shí)填硕,進(jìn)程將自動(dòng)重啟鹿鳖。
http://localhost:8080
2、端口修改:src/conf/config.yaml
3恋拍、增加規(guī)則:src/routes.js
router.exact('/test', Response('hello world'));
4藕甩、安裝模塊:安裝后的模塊以源文件形式存放在src/module目錄
node qs module install {module name}