The purpose of this repository is to show a good end-to-end project setup and workflow for writing Mongoose, Node.js, Express code in TypeScript complete with middleware, models, testing, routes and types.
This project comes with a complete REST API to handle Authentication and CRUD features on Users as well as handle Lists and their corresponding Tasks.
- TypeScript v4
- Testing with Jest
- Linting with Eslint, Prettier and TypeScript
- Pre-commit hooks with Husky
- VS Code debugger scripts
- Local development with Nodemon
Starts the application in development using nodemon
and ts-node
to do hot reloading.
Starts the app in production by first building the project with npm run build
, and then executing the compiled JavaScript at build/index.js
.
Builds the app at build
, cleaning the folder first.
Runs the jest
tests once.
Run the jest
tests in watch mode, waiting for file changes.
Format your code.
Format your code in watch mode, waiting for file changes.
- Using ESLint and Prettier in a TypeScript Project: https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project
- https://levelup.gitconnected.com/everything-you-need-to-know-about-the-passport-local-passport-js-strategy-633bbab6195
- https://medium.com/swlh/everything-you-need-to-know-about-the-passport-jwt-passport-js-strategy-8b69f39014b0
- https://levelup.gitconnected.com/deriving-signing-and-verifying-a-jwt-json-web-token-with-node-js-f3d0d12b1fc9 -http://toon.io/understanding-passportjs-authentication-flow/
- https://mannhowie.com/auth
- https://developer.aliyun.com/mirror/npm/package/mamodom-mongodb-memory-server
- https://dev.to/dyarleniber/parallel-tests-in-node-js-with-jest-and-mongodb-without-mocking-4jj2
- https://dev.to/paulasantamaria/testing-node-js-mongoose-with-an-in-memory-database-32np
- https://www.freecodecamp.org/news/end-point-testing/#part1
- https://zellwk.com/blog/endpoint-testing/
- https://hackmd.io/@abernier/SJrDZvRTB?type=view
- https://www.freecodecamp.org/news/end-point-testing/
- https://zellwk.com/blog/jest-and-mongoose/
- https://dev.to/ziishaned/open-multiple-mongodb-connection-in-express-js-app-36be