This project is a simple backend API built using Node.js and Express.js that creates a new file with the current timestamp as the filename and content. It uses the built-in fs module for file system access and date-fns for date formatting π.
- Node.js
- Express.js
- fs (file system Module)
- date-fns
- dotenv
- CORS
If you hit /file at 17th June 2025, 10:30:45, a file will be created like:
TimeStamps/17-06-2025-10-30-45
And the content will be:
17-06-2025-10-30-45
- Using Express.js to set up routes
- Reading and writing file using
fs - Formating timestamps using
date-fns - Creating REST APIs
- Using
dotenvfor environment configuration
- Ensure the
TimeStampsfolder exists before starting the server. - Make sure the port in
.envis not already used by another process.