This is a simple Express.js application designed to fulfill various requirements, including serving static files, handling different routes, creating and deleting files, and uploading files using both multer
and express-fileforge
.
Live URL: https://assignment2.netwix.xyz/
- HTTP Server Creation: The app utilizes the
express
module to create an HTTP server. - Port Listening: The server listens on port 5500.
- Logging: A message is logged to the console when the server starts listening on port 5500.
- Routing:
/
: Displays the Home Page./about
: Displays the About Page./contact
: Displays the Contact Page./file-create
: Renders a page to create files./file-upload
: Renders a page to upload files.
- File Operations:
fs.writeFile()
: Creates a file nameddemo.txt
with the content "hello world" when requested via/file-create
.- File deletion is supported via
/fileDelete
route.
- File Upload:
- Utilizes
multer
for file uploading (/uploadMulter
route). - Also demonstrates file upload using
express-fileforge
(/uploadFileforge
route).
- Utilizes
-
Installation:
npm install
-
Run the Server:
node app.js
-
Accessing Routes:
- Home Page: http://localhost:5500/
- About Page: http://localhost:5500/about
- Contact Page: http://localhost:5500/contact
- Create File Page: http://localhost:5500/file-create
- Upload File Page: http://localhost:5500/file-upload
- Express.js
- Body-parser
- EJS
- Multer
- Express-fileforge
- Ensure proper file permissions for file operations.
- Customize routes and functionalities as per project requirements.
[Your Name/Email/Contact Information]