Comparing version 2.0.3 to 2.0.4
49
index.js
@@ -1,1 +0,48 @@ | ||
console.log("netget"); | ||
const http = require('http'); | ||
console.log("Welcome to netget."); | ||
// Server component | ||
const server = http.createServer((req, res) => { | ||
res.statusCode = 200; | ||
res.setHeader('Content-Type', 'text/plain'); | ||
res.end('Hello from netget server!'); | ||
}); | ||
// Client component | ||
const connect = (host, port) => { | ||
const options = { | ||
hostname: host, | ||
port: port, | ||
path: '/', | ||
method: 'GET', | ||
}; | ||
const req = http.request(options, (res) => { | ||
let data = ''; | ||
res.on('data', (chunk) => { | ||
data += chunk; | ||
}); | ||
res.on('end', () => { | ||
console.log('Response from netget server:', data); | ||
}); | ||
}); | ||
req.on('error', (error) => { | ||
console.error('Error connecting to netget server:', error); | ||
}); | ||
req.end(); | ||
}; | ||
module.exports = { | ||
listen: (port) => { | ||
server.listen(port, () => { | ||
console.log(`netget server is listening on port ${port}`); | ||
}); | ||
}, | ||
connect: (host, port) => { | ||
connect(host, port); | ||
}, | ||
}; |
{ | ||
"name": "netget", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Rette Adepto/ Recibido Directamente.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,15 +0,41 @@ | ||
# netget | ||
mLearning - Lisa | ||
# netGet | ||
netGet Protocol usage and examples. | ||
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. | ||
netGet installable: | ||
host = ws.netget.me; | ||
**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. | ||
Technologies used: | ||
- websockets | ||
- nodejs | ||
To access the netget module and test its functionalities after installing neurons.me, you can follow these steps: | ||
Sui Gn | ||
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. |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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 3 instances in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
41
2
3533
4
45