diff --git a/packages/medusa/src/api/routes/store/customers/get-customer.js b/packages/medusa/src/api/routes/store/customers/get-customer.js new file mode 100644 index 0000000000..e8dc947e22 --- /dev/null +++ b/packages/medusa/src/api/routes/store/customers/get-customer.js @@ -0,0 +1,10 @@ +export default async (req, res) => { + const { id } = req.params + try { + const customerService = req.scope.resolve("customerService") + let customer = await customerService.retrieve(id) + res.json({ customer }) + } catch (err) { + throw err + } +} diff --git a/packages/medusa/src/api/routes/store/customers/list-customers.js b/packages/medusa/src/api/routes/store/customers/list-customers.js new file mode 100644 index 0000000000..c64cc20aa9 --- /dev/null +++ b/packages/medusa/src/api/routes/store/customers/list-customers.js @@ -0,0 +1,12 @@ +export default async (req, res) => { + const selector = {} + + try { + const customerService = req.scope.resolve("customerService") + const customers = await customerService.list(selector) + + res.json({ customers }) + } catch (error) { + throw error + } +}