gpt-3.5-turbo-0125· openai
from WildChat-4.8M
Write a big random nodejs usefull codes
- User
Write a big random nodejs usefull codes
- Assistant
const http = require('http'); const fs = require('fs');
// Create a server const server = http.createServer((req, res) => { // Send a response header with a status code of 200 and content type of text/plain res.writeHead(200, {'Content-Type': 'text/plain'});
// Read a file asynchronously and send its content as the response fs.readFile('example.txt', (err, data) => { if (err) throw err; res.end(data.toString()); }); });
// Start the server on port 3000 server.listen(3000, '127.0.0.1', () => { console.log('Server running on port 3000'); });