My attempt at formulating an Express starter similar to my App Academy template
npm init -y
to initialize a new packagegit init
to create a new Git repositorytouch .gitignore
to add a.gitignore
file- Add
node_modules
into this file so we don't upload packages
- Add
-
touch .sequelizerc
to create a new Sequelize configurationconst path = require('path'); module.exports = { config: path.resolve('config', 'database.js'), 'models-path': path.resolve('db', 'models'), 'seeders-path': path.resolve('db', 'seeders'), 'migrations-path': path.resolve('db', 'migrations'), };
-
touch .env
to create a file for our environment variables -
Add
.env
to the.gitignore
file so we don't upload our.env
file to GitHub -
In Postgres:
- Create a new
USER
/ROLE
to administrate your app:CREATE ROLE **username** WITH ENCRYPTED PASSWORD '**password**';
- Create a new
DATABASE
for your app and set the owner to be theROLE
you created previously:CREATE DATABASE **database** WITH OWNER **owner**;
- Create a new
- express - Fast, unopinionated, minimalist web framework for Node.js
- csurf - Node.js CSRF protection middleware. Requires either a
session
middleware orcookie-parser
to be initialized first. - cors - used to enable CORS with various options.
- express-html-sanitizer - Middleware for Express JS to cleanup/sanitize JSON request body in express RESTful Service or in any JSON input containing unwanted HTML tags.
- @faker-js/faker - Generate massive amounts of fake data
- Time Conversion Packages
- dotenv - Loads environment variables from a
.env
file intoprocess.env
- per-env - Allows you to do certain things in
Node
based on theenvironment
settings.NODE_ENV
defaults todevelopment
- bcrypt - A package to help hash passwords
- cookie-parser - Parse Cookie header and populate req.cookies with an object keyed by the cookie names. Optionally you may enable signed cookie support by passing a secret string, which assigns req.secret so it may be used by other middleware.
- express-bearer-token - will attempt to extract a bearer token from a request from these locations:
- The key access_token in the request body.
- The key access_token in the request params.
- The value from the header Authorization: Bearer .
- (Optional) Get a token from cookies header with key access_token. If a token is found, it will be stored on req.token. If one has been provided in more than one location, this will abort the request immediately by sending code 400 (per RFC6750).
- express-html-sanitizer - cleanup/sanitize JSON request body in express RESTful Service or in any JSON input containing unwanted HTML tags.
- express-validator - A library of string validators and sanitizers.
- jsonwebtoken - Implementation of JSON Web Tokens
- morgan - HTTP request logger middleware for node.js
- pg - Non-blocking PostgreSQL client for Node.js. Pure JavaScript and optional native libpq bindings.
- sequelize - Promise-based Node.js ORM tool for Postgres
- sequelize-cli - Sequelize Command Line Interface (CLI)
- nodemon - Helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.