This is a small email generation application. There is a front end that accepts user input for sign up and a node script, that when run, will send emails with a random message from a list of predetermined message objects.
Tech | Version | Notes |
---|---|---|
Node.js | 18.7.17 | |
React | 18.2.0 | |
Prisma | ^4.3.1 | |
Express | ^4.18.1 | |
Next | 12.3.0 | |
MySQL | ^2.18.1 |
First install all dependencies:
npm install
To test that the application is installed locally and correctly, run:
npm run dev
Once this command is run, you can open the application at localhost:3000
Create a .env file by running the following in your applications directory:
touch .env
Enter the following environment variables into your new .env file:
sender=<email address to be sent from>
HOSTNAME=localhost
SERVER_PORT=<Port your local server is running on>
HOST=http://$HOSTNAME:$SERVER_PORT
This application is set up to use Prisma ORM and a local dev.db file to contain users
and messages
To get the database running in your local environment, as well as to display the Prisma UI in your browser, follow these instructions:
โ๏ธ For the following steps, open a second terminal
npm install prisma --save-dev
npx prisma db push (db may already be in sync with project)
npm run seed
npx prisma studio
Note: npx prisma studio
will open Prisma's UI dashboard at localhost:5555
๐จ 3 users and 10 messages will be created
note: you can use the frontend to create more users if you'd like
โ๏ธ For the following steps, open a third terminal
This application unitilizes nodemailer to process the request to send emails in an "easy as cake" way.
npm install nodemailer
This application is set up to use mailhog SMTP as it's email transaction manager.
Install mailhog locally by running:
brew update && brew install mailhog
sudo apt-get -y install golang-go
go get github.com/mailhog/MailHog
Then:
run mailhog
to start mail server
mailhog runs on http://localhost:8025/
in a new terminal run npm run send-mail
and watch the magic happen