Heres my backened code with the included routes. Im not sure if the error is located here but ive read some articles that it is most likely an issue with your backenend but i don't have the experience to detect what is wrong, Im looking to see if anyone can detect an issue.
const express = require('express');
const { signup, login } = require('../controllers/auth.js');
const router = express.Router();
router.post('/signup', signup);
router.post('/login', login);
module.exports = router;
I keep getting a 404 error for some reason. Im not sure if its my url path or an error within my backened code.
const handleSubmit = async (e) => {
e.preventDefault()
const { username, password, phoneNumber, avatarURL } = form;
const URL = 'http://localhost:5000/auth';
const { data: { token, userId, hashedPassword, fullName } } = await axios.post(`${URL}/${isSignup ? 'signup' : 'login'}`, {
username, password, fullName: form.fullName, phoneNumber, avatarURL,
});
window.location.reload();
}