express-ts-api-base
v1.0.0
Published
<h1 align="center">Deta Tsx Express Template</h1> <p align="center">Deta micros template with typescript + tsx + express + tsup template</p>
Readme
Features
- 🔥 Path alias
- 🔥 Watch mode (like nodemon)
- 🔥 Simple config
- 🔥 ESNext syntax
- 🔥 Fast and minify!
- minify build (default)
- treeshake (default)
Deta currently does not have that many starter template options to choose from. In past, I always used BetaHuhn/deta-express-starter, this starter template is very good, but some coding style and config do not suit me.
As a vue developer, I'm very used to using path alias. But implementing typescript path alias always has problems after complie.
Finally, after tried vite-node / tsx and tsup / esbuild can resolves all the problems.
But vite-node hmr(watch-mode) has some problem that can't be used, so I'm choosing to use tsx
Quickstart
notice: rename .env.example to .env
- install the deps
$ yarn- development start
$ yarn dev- build for prod
$ yarn build- preview prod
$ yarn previewConfig path alias
Default path alias is @ target to the src folder.
If you wanna change it or add new alias, just modify tsconfig paths:
tsconfig.ts
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*":["./src/*"]
},
}FAQ
Why build output is a single file ?
If you want output to keep origin structure, just gotsup.config.tsand change theentryproperty to:
entry: ['src/**/*.ts']