Simple Tutorials | Clean Reusable Code Snippets
Rather watch a tutorial?
https://www.youtube.com/watch?v=-Gnn-tBG9qQ
Purpose of this tutorial
To give you a quick/easy way to create a new typescript node project!
To get started, download the project as zip from:https://gitlab.com/medinadev.com.tutorials/easy-typescript-starter/-/archive/master/easy-typescript-starter-master.zip then rename to fit your needs!
You can also find this project on GitLab if needed: https://gitlab.com/medinadev.com.tutorials/easy-typescript-starter
How to run this project?
In root directory, run the following commands:
npm install
npm run build
npm start
You should see the following console output:
node ./dist/main.js
progam start..
progam end..
Terminal will be reused by tasks, press any key to close it.
What is this project doing?
npm install
— creates node modules folder and installs dependenciesnpm build
— complies project typescript into javascript and places the .js files in /dist. NOTE: This requires typescript to be installed, you can install it like so:run npm install -g typescript
npm start
— starts the program by runningnode ./dist/main.js
How can I reuse this project?
- rename project to the project you whatever you like
- change package.json “name” field to represent your project
- start coding in main.ts!
What else is included in this project?
Node Types
Node types were installed to allow your typescript classes to easily use node libraries – defined in package.json
.gitignore
Added so you don’t accidentally commit and push the /node_modules folder when you decide to use this project in your git branch