Distributed architectures where the Internet of Things (IoT) and the cloud are efficiently integrated play an increasingly important role for IoT solutions. Among these architectures, there is a growing interest in the ones that support the opportunity of functionality offloading towards either intermediate fog nodes or IoT end devices. Relevant existing research work has mainly focused so far on virtual machine and container migration to intermediate fog nodes and on migration of very simple functions to IoT endpoints (to preserve their limited resources available). In this paper, we originally concentrate on the gap associated with benefitting from fog functionality at resource-powerful IoT endpoints, to create a continuum deployment that glues IoT devices and the cloud. In particular, this paper originally presents a middleware that manages application deployment and life-cycle by simplifying and optimizing management operations such as device configuration and application constraint satisfaction. The proposed solution particularly fits highly articulated scenarios with large numbers of IoT devices and intermediate fog nodes, by supporting the opportunity to offload functionality in a split way between IoT endpoints and edge nodes. The reported experimental results confirm the feasibility of our approach in term of overhead, scalability, and application life-cycle management.