Skip to content

Commit

Permalink
Copilot third commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Giathi-Daniel committed Jan 28, 2025
1 parent 846e823 commit dc88da0
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions comments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Create a web server
41 changes: 41 additions & 0 deletions my-web-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# my-web-server/my-web-server/README.md

# My Web Server

This project sets up a basic web server using Node.js. It serves as an entry point for handling HTTP requests and responses.

## Getting Started

To get a local copy up and running, follow these steps:

1. Clone the repository:
```
git clone https://github.com/yourusername/my-web-server.git
```

2. Navigate to the project directory:
```
cd my-web-server
```

3. Install the dependencies:
```
npm install
```

4. Start the server:
```
npm start
```

## Usage

Once the server is running, you can access it at `http://localhost:3000`. You can modify the request handling in `src/server.js` to suit your needs.

## Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.

## License

This project is licensed under the MIT License.
14 changes: 14 additions & 0 deletions my-web-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "my-web-server",
"version": "1.0.0",
"description": "A basic web server using Node.js",
"main": "src/server.js",
"scripts": {
"start": "node src/server.js"
},
"dependencies": {
"express": "^4.17.1"
},
"author": "",
"license": "ISC"
}
17 changes: 17 additions & 0 deletions my-web-server/src/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Import the http module
const http = require('http');

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

// Define the port
const PORT = process.env.PORT || 3000;

// Start the server
server.listen(PORT, () => {
console.log(`Server running at http://localhost:${PORT}/`);
});

0 comments on commit dc88da0

Please sign in to comment.