项目作者: AdoryVo
项目描述 :
Template for a Node.js/Express website stylized with Bootstrap CSS.
高级语言: HTML
项目地址: git://github.com/AdoryVo/node-website-template.git

DEPRECATED/OUTDATED
This project has moved to another repo here.
📝 node-website-template
Use this template to initialize your Express, MongoDB, and Node.js web application or website with a basic structure and starter code stylized with Bootstrap.
Work In Progress
🚀 Getting Started
Installation
Initialization & Setup
- Create a
.env
file to hold environment variables. (dotenv module) - Edit the name of your database by editing the
DB_NAME
constant in index.js
. - Edit metadata information for SEO and data accuracy in:
package.json
README.md
dist/manifest.json
dist/robots.txt
dist/sitemap.xml
views/landing.ejs
- Run
npm install
to install packages.
🎓 Usage/Workflow Details
Development Process
- Ensure that your MongoDB server is running locally for database functionality.
- Run
nodemon
in your terminal while testing to automatically refresh your back-end after editing. - Develop front-end by creating HTML pages w/ EJS in the
views
directory and editing styles in dist/styles/styles.css
. - Work on back-end by editing
models
, routes
, and index.js
. - (optional) Customize Bootstrap CSS in
src/custom.css
and compile it with npm run sass
to export your bundled CSS to dist/styles/bootstrap.css
.
Scripts
Run npm install
in the root directory to install packages.
Run npm run sass
to compile Bootstrap CSS from the src
folder.
Run npm run build
to compile CSS and Javascript from the src
folder.
Run npm run build:css
to compile Bootstrap CSS and postprocess vendor prefixes in dist/styles/styles.css
.
Run npm run build:js
to compile (w/ webpack) JavaScript libraries from the src
folder.
Directory Details
- The
dist
directory contains front-end and site metadata. - The
models
directory contains MongoDB models. - The
routes
directory contains routes for endpoints and API calls. - The
src
directory contains pre-compiled Bootstrap CSS and JS that is to be bundled into front-end (dist
) using the
scripts mentioned above in the Installation Details. - The
views
directory contains the EJS pages to be rendered by Express.
Deployment
- Create a MongoDB Atlas database and collection and copy your connection URI.
- Create a Heroku app and enable automatic deployment to your repository.
- Set environment variables for your Heroku app
- MONGO_URI - Your MongoDB Atlas connection URI.
- SESSION_SECRET - Express session secret
⚓ Current Release Details
Bootstrap CSS v5.0.0
Express v4.x
Mongoose v5.11.15
Packages Included
- @fortawesome/fontawesome-free - Font Awesome Icons
- autoprefixer - adding vendor prefixes to css
- bcrypt - password-hashing
- bootstrap & @popperjs/core - styling
- body-parser - essential for express
- chalk - colorful terminal output
- compression, cors, helmet, serve-favicon - essential middleware
- dompurify & jsdom - sanitization
- dotenv - environment variables
- ejs - template engine
- express - essential
- express-session - sessions
- fs-extra - updating Font Awesome icons
- jquery - dynamic page elements
- lodash - coding utility
- method-override - enabling methods for the client
- mongoose - database functionality
- nodemon - development quality of life
- postcss & postcss-cli - CSS postprocessing (ex: autoprefixer)
- sass - customizing and compiling Bootstrap
- validator - formatting validation
- webpack & webpack-cli - JS postprocessing
📅 Future Release Plans
- Different ports for other styling frameworks like Tailwind
- E-mail encryption and forgot password functionality
- More detailed starter code
- Additional example pages
🗒️ Additional Resources
Best Practices
Documentation