express-portfolio

express-portfolio

Node/Express app that powered my portfolio website. It has a Nodemailer contact form and a blog that uses Postgres and Knex to access posts. Styled with Bootstrap 4 and Sass. See new repo `jekyll-portfolio` for live site code.

Express-Portfolio

Travis CI build of master branch:

Express-Portfolio serves my portfolio website. It includes a project gallery, a blog, and an email contact form.

See CHANGELOG.md for version history.

Install

npm install

Knex migration files are included to create three tables in the database: posts, projects, and users. Run these with knex migrate:latest.

A Knex seed file is included to populate the projects table with my portfolio project data. Run this with knex seed:run.

Contact form setup

Currently, server.js is set up to use Gmail to send mail using Nodemailer. To create your own instance of this app, you would need to add your Gmail account and an application-specific password to the environment:

export [email protected]
export GMAIL_PASS=YourGoogleAppSpecificPassword

Read more about using Gmail with Nodemailer on the offical site, and see my blog post on the topic for more info.

You can alternatively place the GMAIL_USER and GMAIL_PASS variables in a .env file, as detailed below.

Environment variables using .env

The included .env.example file can be used to create a .env file to hold environment variables in an easily accessible place in the project directory.

server.js contains a reference to an environment variable that can be used to hold a Google Analytics tracking ID, which gets used in the views/partials/_head.ejs partial:

export GA_TRACKING_ID=YourGoogleAnalyticsTrackingID

The route file routes/resume.js contains a reference to the environment variable RESUME_LINK, which can be set in your .env file to create a short, easily-remembered link to an external resume file.

Database setup

The included Knex migration files are used for creating tables of blog posts and portfolio projects in a Postgres database. These variables in the .env file can be used to configure your database:

DB_HOST=
DB_USER=
DB_PASS=
DB_NAME=
DB_SSL=
DB_PORT=

Test

npm test will run StandardJS linting (failing and exiting if there any errors) followed by Mocha/SuperTest unit and integration tests.

Run

npm start to run on port 3000.

Dependencies

Dev dependencies

Contact the Author

Tyler Krys made this.