Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mouni2619/nodejs-filesystem
This Node.js code sets up a basic Express server that provides two main endpoints for handling file operations.this server provides a simple API for creating text files with timestamps and listing existing files, demonstrating basic file system operations in a Node.js environment using Express.
https://github.com/mouni2619/nodejs-filesystem
expressjs filesystem nodejs readdir writefile
Last synced: about 6 hours ago
JSON representation
This Node.js code sets up a basic Express server that provides two main endpoints for handling file operations.this server provides a simple API for creating text files with timestamps and listing existing files, demonstrating basic file system operations in a Node.js environment using Express.
- Host: GitHub
- URL: https://github.com/mouni2619/nodejs-filesystem
- Owner: mouni2619
- Created: 2024-03-11T18:17:25.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-11T18:59:09.000Z (8 months ago)
- Last Synced: 2024-03-19T12:55:51.329Z (8 months ago)
- Topics: expressjs, filesystem, nodejs, readdir, writefile
- Language: JavaScript
- Homepage: https://nodejs-filesystem-8syx.onrender.com/
- Size: 2.19 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# This Node.js code sets up a basic Express server that provides two main endpoints for handling file operations.
https://nodejs-filesystem-8syx.onrender.com/
1)The /create-file endpoint creates a new text file in the TextFiles directory. It generates a file name based on the current date and time, and writes the current timestamp as the file content. The server responds with a success message if the file is created successfully, or an error message if there is a problem.
https://nodejs-filesystem-8syx.onrender.com/create-file
2)The /list-files endpoint reads the contents of the TextFiles directory and returns a list of file names.
https://nodejs-filesystem-8syx.onrender.com/list-filesAdditionally, there is a default route that handles any other requests and responds with a 404 error message for paths that do not match any defined routes.
https://nodejs-filesystem-8syx.onrender.com/list
Overall, this server provides a simple API for creating text files with timestamps and listing existing files, demonstrating basic file system operations in a Node.js environment using Express.