https://github.com/walidbosso/nodejs_playground
Creating a server, and then listening to a request and show a response based on it, if /read then I read the content of a file and show it on the browser, I can also write and append content to the file.
https://github.com/walidbosso/nodejs_playground
file-manipulation nodejs nodejs-api nodejs-server requests
Last synced: 3 days ago
JSON representation
Creating a server, and then listening to a request and show a response based on it, if /read then I read the content of a file and show it on the browser, I can also write and append content to the file.
- Host: GitHub
- URL: https://github.com/walidbosso/nodejs_playground
- Owner: walidbosso
- License: apache-2.0
- Created: 2023-09-26T08:16:55.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-10T18:38:12.000Z (over 1 year ago)
- Last Synced: 2025-03-23T03:32:35.893Z (7 months ago)
- Topics: file-manipulation, nodejs, nodejs-api, nodejs-server, requests
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://github.com/walidbosso/Nodejs_playground)
# Node.js Playground
Welcome to the Node.js Playground! This project demonstrates the creation of a simple Node.js server that listens for requests and responds accordingly. The server can read content from a file, write and append content to it, providing a basic introduction to file manipulation with Node.js.
## Features
- **Node.js Server:** Simple server setup using Node.js.
- **Read File Content:** Handles requests to `/read` to read the content of a file (`data.txt`) and displays it in the browser.
- **Write and Append Content:** Handles requests to write and append content to a file (`writedata.txt`).## Topics Covered
- Node.js
- HTTP Requests
- File Manipulation## Files and Folders
- **app.js:** Contains the main logic for handling server requests.
- **data.txt:** Sample file for reading content.
- **writedata.txt:** File for writing and appending content.
- **index.js:** Entry point for the Node.js application.
- **package.json:** Project configuration file.
- **package-lock.json:** Lock file for Node.js dependencies.## How to Use
1. Clone the repository:
```bash
git clone https://github.com/walidbosso/Nodejs_playground.git
```2. Navigate to the project directory:
```bash
cd Nodejs_playground
```3. Install dependencies:
```bash
npm install
```4. Run the Node.js server:
```bash
node index.js
```5. Open your browser and navigate to `http://localhost:3000/read` to read the content of `data.txt`.
6. To write and append content, make a POST request to `http://localhost:3000/write` with the desired content in the request body.
## License
This project is licensed under the [Your License Name] License - see the [LICENSE](LICENSE) file for details.
## Contributing
If you'd like to contribute to the project, please follow these steps:
1. Fork the repository.
2. Create a new branch (`git checkout -b feature/your-feature`).
3. Commit your changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature/your-feature`).
5. Open a pull request.## Issues
If you encounter any issues or have suggestions, please open an issue on the [Issues](https://github.com/walidbosso/Nodejs_playground/issues) page.
Thank you for exploring the Node.js Playground! 🚀
----------------------
> >
© *by Walid BOUSSOU* 🇲🇦 😄
----------------------👏 Thanks for the support
## Stargazers
[](https://github.com/walidbosso/Nodejs_playground/stargazers)
## Forkers
[](https://github.com/walidbosso/Nodejs_playground/network/members)
## Contributors

𝚂𝚑𝚘𝚠 𝚜𝚘𝚖𝚎 💙 𝚋𝚢 𝚜𝚝𝚊𝚛𝚛𝚒𝚗𝚐 ⭐ 𝚝𝚑𝚎 𝚛𝚎𝚙𝚘𝚜𝚒𝚝𝚘𝚛𝚢!