How to import npm-dependency from a controller?

Hello!
i’m new to working with enonic.
I’m trying to call a 3rd party api from a controller using a dependency in package.json. However the import and require statments in the top of the file causing a 404 not found error. How do i solve this?

Hi Ammar, and welcome! :partying_face:

It’s a bit unclear what you mean by this. Can you share some more examples of your code? Are you trying to do this client side, or server side?

1 Like

HI
i’m doing this on the server side. When i call a post from the client, i get 404 error

Are you sure you are posting to correct endpoint? You have lots of logging inside the POST handler, does this code ever get triggered?