Hi all, I'm a new (prospective) Medusa user and (potential) contributor. Have got many years of enterprise ecom experience, and was pleased to come across Medusa several days ago in researching OSS headless commerce options.
I'm curious if anyone is running Medusa from within an existing NodeJs/ExpressJs application, as that happens to be my existing API stack. I would prefer not to make network calls across two Heroku apps – it'd be great if Medusa could expose its routes from within my existing API deployment, and share the same Redis and Postgres instances I already have.
I've had a look at some of the source code:
https://github.com/medusajs/medusa/blob/master/packages/medusa/src/api/index.js
And can see that the default exports are regular ExpressJs routers.
Is it possible to import these routers from within an existing ExpressJs app directly, instead of running a completely separate Medusa instance?
Alternatively, I might be able to serve my use case by calling Medusa services directly:
import { ProductService } from '@medusajs/medusa'
const productService = new ProductService()
productService.create(...options)
However, I'm not sure how to go about populating the injected dependencies required to initialise a new ProductService instance.
Cheers!