- Runs a web server using Express.js.
- Logs visitor time and IP address in a file (
visits.log). - Serves static files from the
public/folder. - Provides a
/logspage to view visit history.
- Install Node.js if you don’t have it.
- Open the project folder in a terminal.
- Install Express:
npm install express
- Start the server:
node server.js
- Open
http://localhost:1409/in your browser. - Click View Logs to see visit records.
| Action | What Happens |
|---|---|
| Open website | Logs visit (time + IP) |
Visit /logs |
Shows all saved visits |
[
{
"time": "2025-02-15T15:55:03.354Z",
"ip": "::1"
},
{
"time": "2025-02-15T15:55:12.980Z",
"ip": "::1"
}
]/project-folder
│-- public/ # Website files
│-- server.js # Runs the server
│-- visits.log # Stores visit logs
│-- package.json # Dependencies
│-- README.mdn # This file
- The server runs on PORT 1409.
- If
visits.logdoes not exist, it will be created automatically.