简体   繁体   中英

file module - node.js

i know that node.js is relativity new.. so i hope that someone here can really help me.

i want to make a simple server-client program that works on windows 7.

i am having some problem in creating a file module.

i have one file lets call it a.js

/* a.js file*/
var net = require('net');
function startServer(port,resourceMap,rootFolder){
//does somthing
}

exports.startServer=startServer;

and then another file b.js in the same folder

/* b.js file*/
var server = require('*.*\a');

for some reason when i try to run the command node b.js it tells me that it does not recognize the module.

i know that in linux

var server = require('./a');

should work. but i searched allot and all the examples that i find are only linux.

i know that it is probably smothing stupid, but i cant seem to find it.

thank you

I don't know what you think that this code block is supposed to do:

var server = require('*.*\a');

Node.js normalizes disk paths between Linux and Windows so using var server = require('./a'); will work just fine on Windows.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM