Comparing version 2.1.2 to 2.1.3
65
index.js
@@ -1,42 +0,25 @@ | ||
const http = require('http'); | ||
const mdns = require('./src/mdns'); | ||
const bonjour = require('./src/bonjour'); | ||
class Netget { | ||
constructor(host, port, protocol) { | ||
this.host = host; | ||
this.port = port; | ||
this.protocol = protocol; | ||
} | ||
listen() { | ||
switch (this.protocol) { | ||
case 'http': | ||
// Create and listen on an HTTP server | ||
break; | ||
case 'ssh': | ||
// Create and listen on an SSH server | ||
break; | ||
// More cases for other protocols... | ||
default: | ||
throw new Error(`Unsupported protocol: ${this.protocol}`); | ||
} | ||
} | ||
close() { | ||
// Close the server | ||
} | ||
} | ||
// Server component | ||
const server = http.createServer((req, res) => { | ||
res.statusCode = 404; | ||
res.end('Not found'); | ||
}); | ||
// Listen on a specific port | ||
const listen = (port) => { | ||
server.listen(port, () => { | ||
console.log(`netget server is listening on port: ${port}`); | ||
}); | ||
}; | ||
// Close the server | ||
const close = () => { | ||
server.close(() => { | ||
console.log('netget server has been closed'); | ||
}); | ||
}; | ||
// Methods: | ||
// Define mdns method | ||
const mdnsMethod = () => { | ||
console.log('mdns method called'); | ||
// Implement the logic for mdns discovery here | ||
}; | ||
// Define bonjour method | ||
const bonjourMethod = () => { | ||
console.log('bonjour method called'); | ||
// Implement the logic for bonjour discovery here | ||
}; | ||
module.exports = { | ||
listen, | ||
close, | ||
mdns: mdnsMethod, | ||
bonjour: bonjourMethod | ||
}; | ||
module.exports = Netget; |
{ | ||
"name": "netget", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "Rette Adepto/ Recibido Directamente.", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "node index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -8,0 +9,0 @@ }, |
@@ -1,43 +0,3 @@ | ||
# netGet | ||
Visiti https://neurons.me for documentation. | ||
netget(@cleaker, port); | ||
This code sets up an HTTP server and client using the http module in Node.js. The server component listens for incoming requests and responds with a simple text message. The connect function allows you to make a client request to a specified host and port. | ||
**The module exports two functions:** <u>listen and connect.</u> The listen function starts the server and listens on the specified port. The connect function initiates a client request to the specified host and port. | ||
You can use this netget module in your project by requiring it and calling the exported functions as needed. | ||
Note: This is a basic example and can be further expanded and enhanced based on your specific requirements. | ||
To access the netget module and test its functionalities after installing neurons.me, you can follow these steps: | ||
Install neurons.me as a dependency in your project by running npm install neurons.me. | ||
In your code, require the netget module by adding the following line: | ||
``` | ||
const netget = require('netget'); | ||
``` | ||
You can now access the functionalities of netget. For example, you can start the server and listen on a specific port using the listen function: | ||
``` | ||
netget.listen(3000); | ||
``` | ||
To make a client request and connect to a server, you can use the connect function: | ||
``` | ||
netget.connect('localhost', 3000); | ||
``` | ||
To test that the netget module is loaded correctly, you can add a simple console log statement: | ||
``` | ||
console.log('netget module loaded successfully!'); | ||
``` | ||
Run your application using node or npm start command, and you should see the console log statement indicating that the netget module is loaded. | ||
By following these steps, you should be able to access the functionalities of the netget module and test that it is loaded correctly in your project. | ||
# netget | ||
https://neurons.me | ||
This Netget class can represent a network connection of any protocol, and the listen method starts the server based on the protocol. You can implement the logic for creating and listening on servers of different protocols in the switch statement. The close method should close the server. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
8
0
3743
92
4