LoginSignup
12
12

More than 5 years have passed since last update.

MeteorからNode.jsのrequireを利用する

Posted at

Meteor
http://meteor.com/

bootstrapすれば良いらしいです。meteorで出来ることが広がります。
例えばシステムコマンド実行やIPアドレス取得は以下のような感じ。

Meteor.methods({
    show_files: function(){
        var exec = __meteor_bootstrap__.require('child_process').exec;
        exec('ls -l ./', function(err, stdout, stderr){
            console.log(stdout);
        }); 
    },  
    show_ip_address: function(){
        __meteor_bootstrap__.require('dns').lookup(
            __meteor_bootstrap__.require('os').hostname(), function (err, addr, fam) {
                console.log('server ip address : ' + addr);
            }   
        )   
    }   
});

気軽にサクッとアプリ作るのにMeteor良いですよね!

12
12
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12