Nest: How to run the project

Created on 22 Apr 2017  路  3Comments  路  Source: nestjs/nest

I've completed the tutorial. But I don't know how the hell run it. And I've been looking in the docs and I found nothing.

Most helpful comment

hey @mishelashala,

Use typescript to build the project.
If it help I joined my package.json in exemple

{
  "name": "nest.js-tutorial",
  "version": "1.0.0",
  "description": "An implmentation tutorial about NestJS",
  "main": "main.js",
  "scripts": {
    "build": "tsc",
    "start": "node dist/main.js"
  },
  "author": "ThomRick",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.17.1",
    "nest.js": "^1.0.0-rc8"
  },
  "devDependencies": {
    "@types/es6-promise": "0.0.32",
    "@types/node": "^7.0.11",
    "typescript": "^2.2.1"
  }
}

and tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es6",
    "sourceMap": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "outDir": "dist",
    "typeRoots": [
      "node_modules/@types"
    ]
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "node_modules"
  ]
}

I have the following project structure:

src
 |
 --- app
 |       |
 |       --- controllers
 |       |           |
 |       |           --- user.controller.ts   
 |       |
 |       --- services
 |       |           |
 |       |           --- user.service.ts
 |       |
 |       --- app.module.ts
 |
 --- main.ts

So I build the project with the command

npm run build

and start it with the command

npm start

All 3 comments

hey @mishelashala,

Use typescript to build the project.
If it help I joined my package.json in exemple

{
  "name": "nest.js-tutorial",
  "version": "1.0.0",
  "description": "An implmentation tutorial about NestJS",
  "main": "main.js",
  "scripts": {
    "build": "tsc",
    "start": "node dist/main.js"
  },
  "author": "ThomRick",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.17.1",
    "nest.js": "^1.0.0-rc8"
  },
  "devDependencies": {
    "@types/es6-promise": "0.0.32",
    "@types/node": "^7.0.11",
    "typescript": "^2.2.1"
  }
}

and tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es6",
    "sourceMap": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "outDir": "dist",
    "typeRoots": [
      "node_modules/@types"
    ]
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "node_modules"
  ]
}

I have the following project structure:

src
 |
 --- app
 |       |
 |       --- controllers
 |       |           |
 |       |           --- user.controller.ts   
 |       |
 |       --- services
 |       |           |
 |       |           --- user.service.ts
 |       |
 |       --- app.module.ts
 |
 --- main.ts

So I build the project with the command

npm run build

and start it with the command

npm start

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cojack picture cojack  路  3Comments

VRspace4 picture VRspace4  路  3Comments

menme95 picture menme95  路  3Comments

marshall007 picture marshall007  路  3Comments

breitsmiley picture breitsmiley  路  3Comments