0

I want to write a function in server.js.

    export const doCreateUserWithEmailAndPassword = (email, password) =>
auth.createUserWithEmailAndPassword(email, password);

So here, I need to get email and password from the client side. When I try to export the function in server.js and use it in client side. I got an error that said

Module not found: You attempted to import ../../../../server/products which fall outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's node_modules/.

Is there anyway I can call a function from server side?

Lillian
  • 113
  • 2
  • 5
  • You need to setup API endpoints for this. Lookup how to create a REST API with nodejs to communicate between the client and server. – Jake Miller Jun 23 '18 at 18:57

1 Answers1

0

Without looking at the file structure, it's difficult to give a definitive answer, although it would seem that that your application is expecting src/ to be your root directory and the relative path is beyond that.

Lloyd Moore
  • 3,117
  • 1
  • 32
  • 32