javascriptnodejs

javascript nodejs

Published on August 12, 2024By DeveloperBreeze

Node.js: How to Create an HTTP Server

const http = require('http');

const server = http.createServer((req, res) => {
    res.statusCode = 200;
    res.setHeader('Content-Type', 'text/plain');
    res.end('Hello, World!\n');
});

server.listen(3000, '127.0.0.1', () => {
    console.log('Server running at http://127.0.0.1:3000/');
});

Comments

Please log in to leave a comment.

Continue Reading:

JavaScript Promise Example

Published on January 26, 2024

php

Automatically add Tailwind CSS and jQuery classes to any table

Published on August 03, 2024

javascriptcsshtml

Building a Real-Time Chat Application with WebSockets in Node.js

Published on August 03, 2024

javascriptcsshtml

JavaScript Code Snippet: Fetch and Display Data from an API

Published on August 04, 2024

javascriptjson

Building a Modern Web Application with React and Redux

Published on August 05, 2024

javascript

Advanced TypeScript: Type Inference and Advanced Types

Published on August 05, 2024

typescript

Building Progressive Web Apps (PWAs) with Modern APIs

Published on August 05, 2024

jsonbash

Weather App with Node.js

Published on August 08, 2024

javascript