This is my first project written from the ground up in Typescript. I've not really had a chance to work with it before but thought I'd give it a shot so that I could have a practical application to show others
-
npm install
- installs all the node dependencies -
Create a
.env
with the following information. The backend is expecting to use postgresql as a database but can also with many other databases if need be. Simply change the line calledclient
in/db/knexfile.ts
to another database and it should in theory work flawlessly. For theTOKEN_SECRET
just generate a random token (e.g.require('crypto').randomBytes(64).toString('hex')
).PORT URL DB_DATABASE USER DB_PASSWORD TOKEN_SECRET
-
npm start
- Starts up the project on the specified port
npm start
- Runs and builds the projectnpm run build
- Compiles the Typescript code to JavaScript in the/dist
foldernpm run build:run
- Runs the compiled JavaScript buildnpm run database-build
- Creates the database, migrates to the latest versions and runs seeding. (npm start
runs this every time)npm run database-teardown
- Rolls-back the latest database migrationnpm run database-update
- Runs the latest migrationnpm run kill-port
- Kills the process running on the specified port as nodemon sometimes doesn't restart correctlynpm run prettier
- Runs prettier on the codebase (recommended before push)
- Typescript
- knex
- nodemon
- JSON Web Tokens
- pino-pretty logging
- eslint
- prettier
- tsc
- swagger