Archive for the ‘node.js’ Category

 

node : passport で twitter, facebook認証, express

5月 10th, 2015

http://passportjs.org/ http://passportjs.org/guide/ app.post(‘/login’, passport.authenticate(‘local’, { successRedirect: ‘/’, failureRedirect: ‘/login’ })); こんな感じで簡単に認証を入れられるようです $ npm install passport –save $ tsd query passport -a install -sr << tsd 0.5.7 – passport/passport.d.ts : : 2015-05-08 12:31 >> express/express.d.ts : : 2015-05-08 12:31 >> node/node.d.ts : : 2015-05-08 12:31 >> running install.. > skipped existing: express/express.d.ts >> written 2 files: […]

Read full article | コメントは受け付けていません。

node express: deprecated req.param(name): Use req.params, req.body, or req.query

4月 7th, 2015

deprecatedと書いてあって良くわからなかったけど router.get(‘/:user(¥¥d+)’, (req,res,next)=>{ req.param(‘user’); }); と書くと deprecated req.param(name): Use req.params, req.body, or req.query だそうで。 router.param(‘user’, (req, res, next, user)=>{ var r = /^\d+$/; if ( r.test(user) ) { req['user'] = user; return next(); } // res.status(404); res.render(‘error/404′); }); router.get(‘/:user’, (req,res,next)=> { console.log(req['user']); }); こんな感じで出来ました。

Read full article | コメントは受け付けていません。

node , express, typescript , grunt 環境修復メモ

3月 31st, 2015

# express とりあえず http://expressjs.com/starter/generator.html $ express myapp $ cd myapp $ npm install package.json を置き換えて npm installでとりあえず # typescript $ npm install tsd $ tsd init tsd.jsonを置き換え https://github.com/DefinitelyTyped/tsd $ tsd reinstall –save –overwrite # grunt http://gruntjs.com/getting-started Gruntfile.jsを置き換え # あと scssとか http://bootflat.github.io/

Read full article | コメントは受け付けていません。

grunt で監視して typescriptを自動コンパイル

3月 16th, 2015

https://www.npmjs.com/package/grunt-typescript $ npm install grunt-typescript –save referenceも各ファイルに書かずに済んで良い感じです Gruntfiles.js module.exports = function(grunt) { grunt.initConfig({ cssmin: { minify: { files: { } } }, typescript: { base: { src: ['src/typescript/**/*.ts'], dest: ‘src/javascript’, options: { module: ‘commonjs’, target: ‘es5′, basePath: ‘src/typescript’, references: [ 'typings/tsd.d.ts' ], watch: ‘src/typescript’ } } } } grunt.loadNpmTasks(‘grunt-typescript’); }; 監視開始 $ grunt typescript Running […]

Read full article | コメントは受け付けていません。

typescript : tsd 定義ファイル管理

3月 16th, 2015

tsdで定義ファイルを管理します。 バージョンの確認が必要ですね $ sudo npm install -g tsd $ tsd init $ tsd query node -v all >> tsd 0.5.7 – node/node-0.10.d.ts : : 2015-03-15 14:36 – node/node-0.11.d.ts : : 2015-03-15 14:36 – node/node-0.8.8.d.ts : : 2015-03-15 14:36 – node/node.d.ts : : 2015-03-15 14:36 $ node -v v0.10.33 $ tsd query node -v ‘=0.10′ >> […]

Read full article | コメントは受け付けていません。

nodejs : version指定してインストール

3月 8th, 2015

$ npm install -g typescript@1.4.1 typescript確認 $ tsc -v message TS6029: Version 1.4.1.0

Read full article | コメントは受け付けていません。

Typescriptを使ってみる。 javascript

3月 7th, 2015

http://www.typescriptlang.org/ visual studioでも利用出来るようですね $ sudo npm install -g typescript Password: /usr/local/bin/tsc -> /usr/local/lib/node_modules/typescript/bin/tsc typescript@1.4.1 /usr/local/lib/node_modules/typescript # とりあえずhandbook http://www.typescriptlang.org/Handbook handbookを一通り読みながら動かしてみた印象は・・・ わかりやすい。 tsと変換後のjsを比較出来るので勉強になりますね 他ライブラリ等利用するには定義ファイルが必要 https://github.com/borisyankov/DefinitelyTyped メジャーな物はあるそうなので良いのかな?と でもメンテナンスされてないと使えなくなるからそのあたりは問題かなと # angularjs https://angularjs.org/ meanスタックと言うのでフロントはgoogleのangularjsで良いようなので http://jp.techcrunch.com/2015/03/06/20150305microsoft-and-google-collaborate-on-typescript-hell-has-not-frozen-over-yet/ でtypescriptで良いようなので 2.x http://mean.io/#!/ とりあえず、meanスタックを使ってみる http://meanjs.org/ どっちが良いの? https://nodejs.org/ http://expressjs.com/ http://vuejs.org/

Read full article | コメントは受け付けていません。

install node.js centos

4月 12th, 2013

http://nodejs.org/ http://serverfault.com/questions/299288/how-do-you-install-node-js-on-centos インストールしてrpm作成 http://nodejs.org/download/ 今日時点で v0.10.4 http://nodejs.org/dist/v0.10.4/node-v0.10.4.tar.gz node-v0.10.4]# ./configure { ‘target_defaults': { ‘cflags': [],                       ‘default_configuration': ‘Release’,                       ‘defines': [],                       ‘include_dirs': [],     […]

Read full article | コメントは受け付けていません。

node.js beginner

4月 12th, 2013

http://nodejs.jp/ http://www.nodebeginner.org/index-jp.html httpdサーバーが何してるか知らない人が読んだら良い勉強になる内容ですね http://nodeguide.com/ 書き方 なるほど、これに併せて書きます。

Read full article | コメントは受け付けていません。