Service based API and code duplication

Hey all,

If I have a few APIs that work together to create a product, but there's common code between them, whats the easiest way to go about sharing common code?

For example, I have 3 APIs that deliver specific services for 1 product. Using AWS API Gateway I can route the incoming requests to the specific API. However all 3 APIs need to send emails. The configuration for that is fairly custom. I could copy the code in to all 3 projects and create duplication, but I feel like this could be a problem when someone makes a change to the way email works and only updates 1/3 projects.

I'm a bit reluctant to spin up yet another service just to send emails as the same thing would apply for any other shared code that makes its way in to the projects, and that starts to get expensive.

From what I can see I have 2 choices:

  1. Code duplication (and deal with it)
  2. Create a lib, have it in its own package, managed separately and bring it in using a package manager. (creates yet another project to manage, but at least its not an entire service of its own)

Is there a better way to do this, have I just approached this completely the wrong way?

submitted by /u/devsidev
[link] [comments]

from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/MVfXW6u

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close