In this paper, we focus on the problem of assigning resources for offloading the computationally intensive tasks of mobile applications from resource-scarce mobile devices to servers located in edge networks to minimize the average completion time of the applications. We consider a system model in which a set of mobile devices is connected to an edge server via a shared communication channel. In addition, we study for the first time the offloading problem for general applications by accounting for the capacity limitations of both the communication channel and the edge server. We first formulate a static offloading problem as a mixed-integer linear programming problem. Then, we extend the static problem to a dynamic offloading problem in which an application can be executed at any time. Due to the complexity of the problem, it is difficult to obtain a solution within a realistic time period. Therefore, we propose an efficient heuristic approach based on congestion awareness. We demonstrate that our proposed heuristic algorithm significantly outperforms previous offloading algorithms in terms of the average completion time.