Basics of Node.js
This commit is contained in:
62
Week-05/Day_01/README.md
Normal file
62
Week-05/Day_01/README.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# Node.js Basics
|
||||
|
||||
## Introduction
|
||||
|
||||
This project demonstrates the basic concepts of **Node.js**.
|
||||
Node.js is a runtime environment that allows JavaScript to run on the server side.
|
||||
|
||||
Node.js allows developers to use JavaScript for backend development.
|
||||
It is built on Chrome’s V8 engine and is used to create fast and scalable applications.
|
||||
|
||||
---
|
||||
|
||||
## Features of Node.js
|
||||
|
||||
* Fast and efficient
|
||||
* Event-driven
|
||||
* Non-blocking I/O
|
||||
* Cross-platform
|
||||
* Used for building APIs and servers
|
||||
|
||||
---
|
||||
|
||||
## Example: Simple Node.js Server
|
||||
|
||||
```js
|
||||
const http = require('http');
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
res.end("Hello from Node.js Server!");
|
||||
});
|
||||
|
||||
server.listen(3000, () => {
|
||||
console.log("Server is running on port 3000");
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## How to Run
|
||||
|
||||
1. Install Node.js
|
||||
2. Create a file `app.js`
|
||||
3. Run the command:
|
||||
|
||||
```
|
||||
node app.js
|
||||
```
|
||||
|
||||
4. Open browser:
|
||||
|
||||
```
|
||||
http://localhost:3000
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Use Cases
|
||||
|
||||
* Backend development
|
||||
* REST APIs
|
||||
* Real-time applications
|
||||
* Chat applications
|
||||
Reference in New Issue
Block a user