This repository serves as a template for setting up a Node.js project with TypeScript. It includes configuration files for tsconfig.json
, package.json
, and nodemon.json
to help users get started quickly.
Make sure you have Node.js and npm installed on your machine.
-
Clone the repository:
git clone https://github.com/your-username/nodejs-typescript-template.git
-
Navigate to the project directory:
cd nodejs-typescript-template
-
Install dependencies:
npm install
To run the project in development mode with automatic code reloading, use:
npm run dev
This command uses nodemon to watch for changes in the src/
directory and restarts the server accordingly.
To build the TypeScript source code, use:
npm run build
This command compiles TypeScript files from the src/
directory to the dist/
directory.
To run the built application in production, use:
npm run prod
This command executes the compiled index.js
file from the dist/
directory.
-
src/
: Contains the source code of the application.index.ts
: Main entry point of the application.helloWorld.ts
: Example module demonstrating TypeScript functionality.
-
dist/
: Output directory where the compiled JavaScript files are stored.
tsconfig.json
: TypeScript compiler configuration.package.json
: Project metadata and script definitions.nodemon.json
: Nodemon configuration for development.