# Function handler from folder outside project

**URL:** <https://forum.serverless.com/t/function-handler-from-folder-outside-project/5421>\
**Category:** Serverless Framework\
**Created:** [August 13, 2018, 12:33pm UTC](https://forum.serverless.com/t/function-handler-from-folder-outside-project/5421 "2018-08-13T12:33:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![appzone](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/appzone/32/2206_2.png) [@appzone](https://forum.serverless.com/u/appzone)\
**Post date:** [August 13, 2018, 12:33pm UTC](https://forum.serverless.com/t/function-handler-from-folder-outside-project/5421/1 "2018-08-13T12:33:52Z")

</div>

Hi,  
is it possible to point function handler to file outside project folder?

ex :  
my folder structure is

A ==\> this is the project folder

- handler.js
- serverless.yml

B

- node\_modules
- handler\_b.js ==\> this have some library from npm

can i do something like this ?  
functions:  
getAll:  
handler: B/handler\_b.getAll

because i get error  
Debug: internal, implementation, error

do i need to npm install all library needed in folder B into my folder A ?

---

<div class="post-metadata">

**Author:** ![jeremydaly](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/jeremydaly/32/2104_2.png) [@jeremydaly](https://forum.serverless.com/u/jeremydaly)\
**Post date:** [August 14, 2018, 1:51pm UTC](https://forum.serverless.com/t/function-handler-from-folder-outside-project/5421/2 "2018-08-14T13:51:28Z")

</div>

Nesting your handler is perfectly acceptable, e.g. `handler: B/handler_b.getAll` should work just fine for routing your requests. I’m not sure I understand why you’d have a separate `node_modules` folder in a subdirectory of a project, but Node.js will typically look for a `node_modules` folder recursively from the directory of the file.

My suggestion would be to package your entire Serverless app as ONE single node module with a single `package.json`. If the two handlers are coupled anyway, I’m not sure what the benefit is of separating them within the same function.

If there is more context to this, please share.
