Skip to content

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.

License

walidbosso/Nodejs_playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nodejs_playground

GitHub WidgetBox


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:

    git clone https://github.com/walidbosso/Nodejs_playground.git
  2. Navigate to the project directory:

    cd Nodejs_playground
  3. Install dependencies:

    npm install
  4. Run the Node.js server:

    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 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 page.

Thank you for exploring the Node.js Playground! 🚀


 
© by Walid BOUSSOU  🇲🇦 😄
 


👏 Thanks for the support

Stargazers

Stargazers repo roster for @walidbosso/Nodejs_playground

Forkers

Forkers repo roster for @walidbosso/Nodejs_playground

Contributors



GitHub last commit (by committer)

GitHub License

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


Back to top

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published