https://github.com/ashirbadgudu/node-express-ts-stater
A Stater Node JS Express Stater With TypeScript
https://github.com/ashirbadgudu/node-express-ts-stater
express hacktoberfest hacktoberfest2022 nodejs nodemon stater-kit ts-node typescript
Last synced: 3 months ago
JSON representation
A Stater Node JS Express Stater With TypeScript
- Host: GitHub
- URL: https://github.com/ashirbadgudu/node-express-ts-stater
- Owner: AshirbadGudu
- Created: 2022-06-10T02:08:46.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-10T17:40:13.000Z (almost 3 years ago)
- Last Synced: 2025-01-21T08:12:05.861Z (4 months ago)
- Topics: express, hacktoberfest, hacktoberfest2022, nodejs, nodemon, stater-kit, ts-node, typescript
- Language: TypeScript
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node JS Express TypeScript Stater
## Steps to setup
### Init `package.json` file
```sh
npm init -y
```### Add `typescript` as a dev dependency
```sh
npm install --save-dev typescript
```### Create `tsconfig.json` file
```sh
npx tsc --init
```### Create `development` and `production` directories
```sh
mkdir server src
```### Define `outDir` in `tsconfig.json` file
```json
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"outDir": "./server",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
}
```### For development purposes install `ts-node` package as a dev dependency
```sh
npm install --save-dev ts-node
```### Add dev script to `package.json` file
```json
{
"scripts": {
"dev": "nodemon --exec ts-node src/index.ts"
}
}
```### Install `express`
```sh
npm i express
```### Install types for `express`
```sh
npm i @types/express --save-dev
```### Install `dotenv`
```sh
npm i dotenv
```### Create following directories
```sh
mkdir test # for holding API test files
mkdir ./src/types # for holding types for project
mkdir ./src/routes # for holding routes of API endpoints
mkdir ./src/controllers # for holding controllers of API endpoints
```