A sample to-do application built with Express.
I wanted to learn Express but all of the tutorials I'd found were either outdated or just plain wrong. I've gathered best practices from multiple, very skilled people and assembled them here.
This is a modern antique multi-page application built with no CSS nor client-side JavaScript.
- Supports multiple instances (not a singleton)
- Simple setup
- SQL migrations
- No SQL concatenation (via a query builder)
- No CSRF
- Form validations
- Logger
Not done yet:
- test suite
Be sure that Git >= 2
, Node.js >= 8
and PostgreSQL >= 9
are installed.
Open a command line at, or change directory (cd
) to where you'd like the project to exist (as a sub-directory).
Checkout the repository:
git clone git@github.com:stevenvachon/todo-express.git
Open the project directory:
cd todo-express
Create the database and user:
npm run createdb
Install all dependencies:
npm install
To start the development server:
npm start
To run the tests:
npm test
To run the tests on file changes:
npm run watch
You can check to see if any dependencies have updates available with:
npm run check-updates
You can remove the database and its user with:
npm run dropdb
You can update the database after breaking changes with:
npm run migrate-up
Advanced migrations will require using knex
directly:
npx knex