An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

![Nodejs_playground](https://socialify.git.ci/walidbosso/Nodejs_playground/image?description=1&font=Source%20Code%20Pro&forks=1&issues=1&language=1&name=1&owner=1&pattern=Formal%20Invitation&pulls=1&stargazers=1&theme=Auto)







[![GitHub WidgetBox](https://github-widgetbox.vercel.app/api/profile?username=walidbosso&data=followers,repositories,stars,commits&theme=nautilus)](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

[![Stargazers repo roster for @walidbosso/Nodejs_playground](http://reporoster.com/stars/dark/walidbosso/Nodejs_playground)](https://github.com/walidbosso/Nodejs_playground/stargazers)

## Forkers

[![Forkers repo roster for @walidbosso/Nodejs_playground](http://reporoster.com/forks/dark/walidbosso/Nodejs_playground)](https://github.com/walidbosso/Nodejs_playground/network/members)

## Contributors





![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/walidbosso/Nodejs_playground?style=social)


![GitHub License](https://img.shields.io/github/license/walidbosso/Nodejs_playground?style=social)









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


Back to top