-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
102 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// routes/customRoutes.js | ||
|
||
const express = require("express"); | ||
const router = express.Router(); | ||
|
||
// Example route: Get all items | ||
router.get("/items", (req, res) => { | ||
// Your logic to fetch items, e.g., from a database | ||
res.json({ message: "Fetching all items..." }); | ||
}); | ||
|
||
// Example route: Create an item | ||
router.post("/items", (req, res) => { | ||
// Your logic to create a new item | ||
const newItem = req.body; // Assuming you send the item data in the request body | ||
res.status(201).json({ message: "Item created", item: newItem }); | ||
}); | ||
|
||
// More custom routes can be added here... | ||
|
||
module.exports = router; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa"; | ||
|
||
export const POST = async (req: MedusaRequest, res: MedusaResponse) => { | ||
const mailchimpService = req.scope.resolve("mailchimpService"); | ||
|
||
// Assuming req.body contains the necessary data for newsletter subscription | ||
const { email, tags } = req.body as { email: string; tags?: string[] }; | ||
|
||
// Subscribe the user to Mailchimp newsletter | ||
await mailchimpService.subscribeNewsletter(email, { tags: tags ?? ["customer"] }); | ||
|
||
// Respond with a success message or appropriate status | ||
res.status(200).json({ message: "Subscription successful" }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters