项目作者: ketangit
项目描述 :
Sample Typescript Nodejs Server application using TypeGraphQL, TypeORM and Node-OracleDB
高级语言: TSQL
项目地址: git://github.com/ketangit/sample-graphql-server.git
Sample Typescript Nodejs Server application using TypeGraphQL, TypeORM and Node-OracleDB
Steps to create base TypeScript project
1. Create a folder
mkdir sample-graphql-server
cd sample-graphql-server
npm init -> creates package.json
2. Install node modules
npm install -D typescript (-D flag is the shortcut for: --save-dev)
npm install -D tslint
npm install -D ts-node nodemon (Create 'nodemon.json' file)
npm install -D @types/node-fetch
npm install -D typescript-tslint-plugin
npm install -D typescript
npm install -D rimraf
npm install dotenv
3. Run the following command to generate a 'tsconfig.json' file
npx tsc --init --rootDir src --outDir dist --esModuleInterop --resolveJsonModule \
--lib es6 --module commonjs --allowJs true --noImplicitAny true
4. Run the following command to generate a 'tslint.json' file
.\node_modules\.bin\tslint --init
5. Create 'index.ts' file which is the start of the server
mkdir src
cd src
index.ts
Steps to add TypeGraphQL and TypeORM dependecies
npm install graphql
npm install apollo-server
npm install -D type-graphql
npm install reflect-metadata
npm install typeorm
npm install oracledb (Oracle Database driver)
npm install typedi (Dpendency injection tool for TypeScript)
npm install typeorm-typedi-extensions (TypeDI Service container integration with TypeORM)
Steps to run this project locally:
- Run
npm install
command to install dependencies - Run
npm run build
command to build application - Run
npm run start-dev
command to run application locally - Open http://localhost:3000
Credit / Prior Art