Skip to content

This project is a basic setup for developing a Node.js application using TypeScript, ts-node, and nodemon for automatic restarts during development.

Notifications You must be signed in to change notification settings

ferrymehdi/ts-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript Project Setup

This project is a basic setup for developing a Node.js application using TypeScript, ts-node, and nodemon for automatic restarts during development.

Getting Started

Prerequisites

Ensure you have Node.js installed. You can download it from nodejs.org.

Installation

  1. Clone the repository:

    git clone https://github.com/ferrymehdi/ts-setup.git
    cd ts-setup
  2. Install the dependencies:

    npm install

Project Structure

ts-setup/
├── src/
│   └── index.ts
├── .gitignore
├── nodemon.json
├── package.json
├── tsconfig.json
└── README.md

Configuration Files

  • tsconfig.json: TypeScript configuration file.
  • nodemon.json: Nodemon configuration file.

Available Scripts

  • npm run build: Compiles TypeScript files to JavaScript.
  • npm run dev: Runs the project in development mode with nodemon and ts-node.
  • npm start: Runs the project directly using ts-node.

Running the Project

  1. Development Mode:

    npm run dev

    This will start the project with nodemon, which will watch for changes in the src directory and automatically restart the server.

  2. Production Mode:

    npm run build
    npm start

    This will compile the TypeScript files into the dist directory and run the compiled JavaScript files.

Example Code

You can find the example TypeScript code in src/index.ts:

const sayHello = (name: string): string => {
  return `Hello, ${name}!`;
};

console.log(sayHello("World"));

License

This project is licensed under the ISC License.

About

This project is a basic setup for developing a Node.js application using TypeScript, ts-node, and nodemon for automatic restarts during development.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published