My deployed node web services 404 error


my project was build and deployed correctly , but on clicking the link this happens… any help

Hey,

We need a bit more detail to be able to help effectively. What steps have you taken so far to try to fix the issue? If you could send over some screenshots, outline the steps to recreate the problem, or provide any other information, that would really help us get a clearer picture of what’s going on and what you’re dealing with.

Jérémy.
Render Support, UTC+3


this is my all log ,

my package.json file content
{
“name”: “realtimechat”,
“version”: “1.0.0”,
“main”: “server.js”,
“scripts”: {
“start”: “node server.js”,
“devStart”: “nodemon server.js”
},
“author”: “”,
“license”: “ISC”,
“dependencies”: {
“cors”: “^2.8.5”,
socket.io”: “^4.7.5”
},
“description”: “”,
“devDependencies”: {
“nodemon”: “>=3.1.2”
}
}

my server.js content
const io = require(‘socket.io’)(3000, { //handles the CORS errors
cors: {
origin: “*”, // Allow any origin
methods: [“GET”, “POST”]
}
});

const users = {}

// Give socket for each user that loads into the web
io.on(‘connection’, socket => {
socket.on(‘new-user’, name =>{
users[socket.id] = name
socket.broadcast.emit(‘user-connected’, name)
})

socket.on('send-chat-message', message => {
    socket.broadcast.emit('chat-message', {message: message, name:
        users[socket.id] 
    });
});

socket.on('disconnect', () => {
    socket.broadcast.emit('user-disconnected', users[socket.id])
    delete users[socket.id]
})

});

my script.js file

const socket = io(‘http://localhost:3000’);
const messageContainer = document.getElementById(‘message-container’);
const messageForm = document.getElementById(‘send-container’);
const messageInput = document.getElementById(‘message-input’);
const usernameForm = document.getElementById(‘username-container’);
const usernameInput = document.getElementById(‘username-input’);
const usernameDisplay = document.getElementById(‘username-display’);

usernameForm.addEventListener(‘submit’, e => {
e.preventDefault();
let userName = usernameInput.value.trim();
if (!userName) {
alert(‘Please enter your name to join the chat.’);
return;
}
appendMessage(‘You joined’);
socket.emit(‘new-user’, userName);
usernameForm.style.display = ‘none’;
usernameDisplay.innerText = Logged in as: ${userName};
messageForm.style.display = ‘flex’;
});

socket.on(‘chat-message’, data => {
appendMessage(${data.name}: ${data.message});
});

socket.on(‘user-connected’, userName => {
appendMessage(${userName} connected);
});

socket.on(‘user-disconnected’, userName => {
appendMessage(${userName} disconnected);
});

messageForm.addEventListener(‘submit’, e => {
e.preventDefault();
const message = messageInput.value.trim();
if (!message) {
// alert(‘Please enter a message before sending.’);
return;
}
appendMessage(You: ${message});
socket.emit(‘send-chat-message’, message);
messageInput.value = ‘’;
});

function appendMessage(message) {
const messageElement = document.createElement(‘div’);
messageElement.innerText = message;
messageContainer.append(messageElement);
}

my root file
image

i dont know what could cause this , it does not seem to read my index.html file
my project use node.js and socket.io for a realtime chat system