신선한 meteor create
프로젝트에서 다음 작업이 가능합니다. /server/main.js
에서
: 콘솔에서
import { Meteor } from 'meteor/meteor';
Meteor.startup(() => {
// code to run on server at startup
});
import net from 'net';
export class Print {
printAsync(callback){
let client = new net.Socket();
console.log(client);
}
}
console.log(net);
const print = new Print();
print.printAsync();
출력 :
I20161129-07:59:18.007(-8)? { createServer: [Function],
I20161129-07:59:18.008(-8)? createConnection: [Function],
I20161129-07:59:18.008(-8)? connect: [Function],
I20161129-07:59:18.008(-8)? _normalizeConnectArgs: [Function: normalizeConnectArgs],
I20161129-07:59:18.008(-8)? Socket: { [Function: Socket] super_: { [Function: Duplex] super_: [Object] } },
I20161129-07:59:18.008(-8)? Stream: { [Function: Socket] super_: { [Function: Duplex] super_: [Object] } },
I20161129-07:59:18.009(-8)? Server:
I20161129-07:59:18.009(-8)? { [Function: Server]
[...]
I20161129-07:59:18.012(-8)? Socket {
I20161129-07:59:18.013(-8)? _connecting: false,
I20161129-07:59:18.013(-8)? _hadError: false,
I20161129-07:59:18.013(-8)? _handle: null,
I20161129-07:59:18.013(-8)? _parent: null,
I20161129-07:59:18.013(-8)? _host: null,
I20161129-07:59:18.013(-8)? _readableState:
I20161129-07:59:18.020(-8)? ReadableState {
I20161129-07:59:18.020(-8)? objectMode: false,
I20161129-07:59:18.020(-8)? highWaterMark: 16384,
[...]
나는 당신의 정의되지 않은 net
을 재현 할 수 아니에요.
가져 오기가 서버 측에서 가져 오지만 가져 오기가 작동하지 않습니다. –
허, 저에게 도움이됩니다. 샘플 레포를 가지고 있습니까? 아니면 더 많은 컨텍스트를 제공 할 수 있습니까? – kooc
질문이 업데이트되었습니다. 변수 net은 정의되지 않습니다. 어떻게 넷 모듈을 가져 왔습니까? npm 패키지를 설치 했습니까? –