DEV Community

Discussion on: Authentication in NodeJS With Express and Mongo - CodeLab #1

 
dipakkr profile image
Deepak Kumar

Try running the GitHub clone with your Db username password.

Thread Thread
 
yugyndprodigy10 profile image
Eugene Taabazuing

How do you now connect it to a frontend login/signup page?

Thread Thread
 
dipakkr profile image
Deepak Kumar

Hi Eugene,

You can simply call the API using axios or fetch to get data.

Here is a sample code snippet on how you can do it.

const config = {
            headers: {
                'Content-Type': "application/json"
            }
 };

const formData = {
input_username,
input_passwrd
};

const response = await axios.post('/user/login', formData, config);
Enter fullscreen mode Exit fullscreen mode

I hope this answers your question.

Thread Thread
 
yugyndprodigy10 profile image
Eugene Taabazuing

It does, thanks!

Thread Thread
 
grsarvesh profile image
GRSARVESH

Eugene, could you paste the full code oh how to link front end and back end and specify where it should be added