.container
.four.columns
div.
<a href="http://www.flickr.com/photos/astrapica/2560897976/" title="Uk express... by astrapi, on Flickr"><img src="http://farm4.staticflickr.com/3049/2560897976_48257593b7.jpg" width="100%" height="120px" alt="Uk express..."></a>
a.button(href="https://github.com/twilson63/express-coffee/zipball/v1.2.1") Download
a.button(href="https://github.com/twilson63/express-coffee") Source
:markdown
### About
This template was built to make it very easy to get up and going on small little prototypes and weekend projects.
### Contact Us
Have questions, or would like to contribute?
* [Post an Issue](https://github.com/twilson63/express-coffee/issues)
* [Submit a pull request](https://github.com/twilson63/express-coffee)
* Follow Us on twitter! [@jackhq](http://twitter.com/jackhq)
$ coffee check.coffee
Error: Invalid integer
at [object Object].error (/Users/inouetomoyuki/node_modules/validator/lib/validator.js:7:11)
at [object Object].isInt (/Users/inouetomoyuki/node_modules/validator/lib/validator.js:29:33)
at Object.<anonymous> (/Users/inouetomoyuki/Projects/node/validator_sample/check.coffee:6:16)
at Object.<anonymous> (/Users/inouetomoyuki/Projects/node/validator_sample/check.coffee:8:4)
at Module._compile (module.js:441:26)
at Object.run (/usr/local/lib/coffee-script/lib/coffee-script/coffee-script.js:73:25)
at /usr/local/lib/coffee-script/lib/coffee-script/command.js:147:29
at /usr/local/lib/coffee-script/lib/coffee-script/command.js:122:18
at [object Object].<anonymous> (fs.js:115:5)
at [object Object].emit (events.js:64:17)
try-catchで囲ってやります。
check.coffee
check = require('validator').check
try
check('abc').isInt()
catch e
console.log(e.message)
$ coffee check.coffee
Invalid integer
エラーメッセージに変更するには、checkメソッドの第2引数に文字列を追加します。
check.coffee
check = require('validator').check
try
check('abc', '整数を入力して下さい').isInt()
catch e
console.log(e.message)
$ coffee check.coffee
整数を入力して下さい
検証する内容をチェーンすることができます。
check.coffee
check = require('validator').check
try
check('123', '4文字から12文字の整数を入力して下さい').len(4,12).isInt()
catch e
console.log(e.message)
$ coffee lint.coffee
TypeError: Cannot call method 'replace' of undefined
at Lexer.tokenize (/Users/inouetomoyuki/.nvm/v0.6.14/lib/node_modules/coffeelint/node_modules/coffee-script/lib/coffee-script/lexer.js:24:19)
at Object.tokens (/Users/inouetomoyuki/.nvm/v0.6.14/lib/node_modules/coffeelint/node_modules/coffee-script/lib/coffee-script/coffee-script.js:58:18)
at new LexicalLinter (/Users/inouetomoyuki/.nvm/v0.6.14/lib/node_modules/coffeelint/lib/coffeelint.js:249:34)
at Object.lint (/Users/inouetomoyuki/.nvm/v0.6.14/lib/node_modules/coffeelint/lib/coffeelint.js:488:21)
at Object.<anonymous> (/Users/inouetomoyuki/Projects/node/coffeelint_sample/lint.coffee:12:23)
at Object.<anonymous> (/Users/inouetomoyuki/Projects/node/coffeelint_sample/lint.coffee:16:4)
at Module._compile (module.js:441:26)
at Object.run (/usr/local/lib/coffee-script/lib/coffee-script/coffee-script.js:73:25)
at /usr/local/lib/coffee-script/lib/coffee-script/command.js:147:29
at /usr/local/lib/coffee-script/lib/coffee-script/command.js:122:18
$ rails new HelloRails
$ bundle
$ rails s
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
$ npm install -g bootstrapped-socket-express
$ bootstrapped new sample_app
Success!
Next, you should:
cd sample_app
sudo npm install
And to start your app:
node server.js
$ cd sample_app
$ npm install
$ node server.js
info - socket.io started
Listening on port 3000
$ git clone https://github.com/qiao/coffee-box
$ cd coffee-box/
$ npm install
$ mongod --dbpath ~/MongoDb (MongoDBを起動しておきます)
$ node index.js
coffee-box server listening on port 3000 in development mode
$ cd ~/.ssh
$ mkdir key_backup
$ cp id_rsa* key_backup
$ rm id_rsa*
$ ssh-keygen -t rsa -C "GitHubに設定した自分のメールアドレス"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/inouetomoyuki/.ssh/id_rsa): [ENTER]
Enter passphrase (empty for no passphrase): [任意のパスワード]
Enter same passphrase again: [任意のパスワード]
Your identification has been saved in /Users/inouetomoyuki/.ssh/id_rsa.
Your public key has been saved in /Users/inouetomoyuki/.ssh/id_rsa.pub.
The key fingerprint is:
XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX "メールアドレス"
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| Finger |
| Print |
| |
| |
| |
+-----------------+
出力されたid_rsa.pubのテキストをコピーしてGitHubへ登録します。
設定できたかテストします。
$ ssh -T git@github.com
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
Identity added: /Users/inouetomoyuki/.ssh/id_rsa (/Users/inouetomoyuki/.ssh/id_rsa)
Hi tomoyukiinoue! You've successfully authenticated, but GitHub does not provide shell access.