Welcome to your first application tutorial! Let's walk through the basics of creating a simple HTTP server application using our framework.
Step-by-Step Guide
Initialize Project
Start by creating a new directory for your project and navigate into it:mkdir my_first_app && cd my_first_app
💡 Tip: Use
touch
to create a main entry point file likeapp.js
.Basic Server Setup
Create a basic server using the following code:const http = require('http'); const server = http.createServer((req, res) => { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World!\n'); }); server.listen(3000, () => { console.log('Server running on port 3000'); });
📌 This example uses Node.js's built-in
http
module.Test Your Server
Run the server with:node app.js
Then visit
http://localhost:3000
in your browser to see the output.
🌐 For more on testing, see our Testing Guide.