DEV Community

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

dipakkr profile image
Deepak Kumar Author

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