@danielres/smtp-mini-dev-server
Advanced tools
Comparing version 1.3.0 to 1.4.0
14
index.js
@@ -7,2 +7,4 @@ #!/usr/bin/env node | ||
const templates = require("./templates"); | ||
const PORT = process.env.DEV_SMTP_PORT || 2500; | ||
@@ -20,3 +22,3 @@ const API_PORT = process.env.DEV_SMTP_API_PORT || 2501; | ||
// return callback(new Error("Invalid username or password")); | ||
callback(null, { user: 123 }); // dummy user to simulate auth success | ||
callback(null, { user: "dummyUser" }); // using a dummy user to simulate auth success | ||
}, | ||
@@ -36,7 +38,13 @@ logger: true, | ||
app.get("/message/:messageId", (req, res) => { | ||
app.get("/", (req, res) => { | ||
const headers = ["messageId", "from", "to", "subject"]; | ||
const messages = Object.values(mailbox).reverse(); | ||
res.send(templates.home({ messages })); | ||
}); | ||
app.get("/:messageId", (req, res) => { | ||
res.json(mailbox[req.params.messageId]); | ||
}); | ||
app.get("/message/:messageId/:field", (req, res) => { | ||
app.get("/:messageId/:field", (req, res) => { | ||
const { field, messageId } = req.params; | ||
@@ -43,0 +51,0 @@ res.send(mailbox[messageId][field]); |
@@ -10,3 +10,3 @@ { | ||
}, | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"main": "index.js", | ||
@@ -13,0 +13,0 @@ "license": "MIT", |
@@ -56,3 +56,3 @@ # SMTP mini dev server | ||
if (error) return reject(error); | ||
const url = `http://localhost:2501/message/${info.messageId}/html`; | ||
const url = `http://localhost:2501/${info.messageId}/html`; | ||
console.log({ url }); | ||
@@ -71,6 +71,7 @@ resolve({ info, response, url }); | ||
- visit `http://localhost:2501/message/${info.messageId}` to view all data related to a paticular message. | ||
- view only specific data: | ||
- `http://localhost:2501/message/${info.messageId}/html` | ||
- `http://localhost:2501/message/${info.messageId}/text` | ||
- visit `http://localhost:2501` for a list of all received messages. | ||
- visit `http://localhost:2501/<MESSAGE_ID>` for all data related to a paticular message. | ||
- view only specific data for a message: | ||
- `http://localhost:2501/<MESSAGE_ID>/html` | ||
- `http://localhost:2501/<MESSAGE_ID>/text` | ||
- ... |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5735
6
119
76