dockerization.

This commit is contained in:
Joshua Ashton
2025-01-27 14:26:40 -07:00
parent a9b1fa419e
commit 3e69802567
34 changed files with 1003 additions and 3470 deletions
+31
View File
@@ -0,0 +1,31 @@
import express from "express";
import cors from "cors";
import postmark from "postmark";
import * as dotenv from 'dotenv';
dotenv.config();
const app = express();
const port = 3001; // Example port
const apiKey = process.env.API_KEY;
const client = new postmark.ServerClient(apiKey);
app.use(cors());
app.use(express.json()); // Parse incoming JSON data
// Example API endpoint
app.post("/api/send-email", (req, res) => {
const email = {
From: "contact@joshashton.dev",
To: "me@joshashton.dev",
Subject: req.body.name + " - " + req.body.emailAddress,
TextBody: req.body.message,
MessageStream: "outbound",
};
client.sendEmail(email);
res.json({ text: "email sent!" });
});
app.listen(port, () => {
console.log(`Server listening on port ${port}`);
});