TypeScript + Express + Sequelize + Passport
Requirement | Reason |
---|---|
mysql |
Mysql Server is required for Sequelize |
Npm Script | Description |
---|---|
start |
Runs node on dist/server.js which is the apps entry point. before this, you should build |
start:dev |
Runs node on src/server.ts with ts-node for development environment. watching your codes change |
prebuild |
Copys asset files in src/views and src/public to dist directory before tsc |
build |
Runs all build tasks, compile TypeScript codes after copying asset files in views, public |
test |
Runs tests using Mocha and Chai |
lint |
Runs ESLint on project files |
lint:fix |
Runs ESLint on project files and fix codes |
- This is not valid at this time. will be updated.
typescript-express-starter
ββ .env
ββ dist
β ββ [ build files ]
ββ src
ββ app.ts β instantiate app
ββ server.ts β entry point which starts server
ββ @types
| ββ express.d.ts β override req.User types for passport.js
ββ config
| ββ passport.ts β config for passport.js
| ββ sequelize.ts β config for sequelize.js
ββ controllers
| ββ user.ts β controller for accounts
| ββ echo.ts β controller for echo test, recommend to delete
| ββ sample.ts β sample template controller
ββ middlewares
| ββ error_handler.ts β middlewares handling all errors.
ββ models
β ββ index.ts β export sequelize instance
| ββ sequelize.ts β instantiate sequelize.ts
| ββ user.ts β User model
| ββ sample.ts β sample template model
ββ public
β ββ common.css β static file which can be accessed with '/common.css'
ββ routes
| ββ user.ts β router for accounts
| ββ echo.ts β router for echo test
| ββ sample.ts β sample template router
| ββ async.wrapper.ts β wrapper for async controller function.
ββ test
ββ starter.spec.ts β initial test cases
MIT