Skip to content

Commit 14b4228

Browse files
author
kamil.mysliwiec
committed
Travis integration & example
1 parent 9ec2d6c commit 14b4228

10 files changed

Lines changed: 59 additions & 5 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
npm-debug.log
1010

1111
# example
12-
/example
1312
/quick-start

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ before_install:
77
- sh -e /etc/init.d/xvfb start
88
script:
99
- npm test
10-
- npm run build
10+
- npm run compile

example/app.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { NestApplication } from "./../src/";
2+
3+
export class Application implements NestApplication {
4+
5+
constructor(private app) {}
6+
7+
start() {
8+
this.app.listen(3030, () => {
9+
console.log("Application listen on port:", 3030);
10+
});
11+
}
12+
13+
}

example/modules/app.module.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { UsersModule } from "./users/users.module";
2+
import { Module } from "./../../src/";
3+
4+
@Module({
5+
modules: [ UsersModule ]
6+
})
7+
export class ApplicationModule {}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { Component } from "./../../../src/";
2+
3+
@Component()
4+
export class UsersQueryService {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { UsersRoute } from "./users.route";
2+
import { UsersQueryService } from "./users-query.service";
3+
import { Module } from "./../../../src/";
4+
5+
@Module({
6+
controllers: [ UsersRoute ],
7+
components: [ UsersQueryService ]
8+
})
9+
export class UsersModule {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Request, Response, NextFunction } from "express";
2+
import { UsersQueryService } from "./users-query.service";
3+
import { RequestMethod, Controller, RequestMapping } from "./../../../src/";
4+
5+
@Controller({ path: "users" })
6+
export class UsersRoute {
7+
8+
constructor(private usersQueryService: UsersQueryService) {}
9+
10+
@RequestMapping({
11+
path: "/",
12+
method: RequestMethod.GET
13+
})
14+
getAllUsers(req: Request, res: Response, next: NextFunction) {}
15+
}
16+

example/server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { NestRunner } from "./../src/";
2+
import { Application } from "./app";
3+
import { ApplicationModule } from "./modules/app.module";
4+
5+
NestRunner.run(Application, ApplicationModule);

karma.conf.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const webpackConfig = require('./webpack.config.test');
33

44
module.exports = function (config) {
55
config.set({
6-
browsers: [ 'Chrome', 'ChromeCanary' ],
6+
browsers: [ 'Firefox' ],
77
colors: true,
88
reporters: [ 'mocha' ],
99
frameworks: [ 'mocha', 'chai', 'sinon' ],
@@ -14,12 +14,12 @@ module.exports = function (config) {
1414
'tests.webpack.js': [ 'webpack' ]
1515
},
1616
webpack: webpackConfig,
17-
customLaunchers: {
17+
/*customLaunchers: {
1818
Chrome_travis_ci: {
1919
base: 'Chrome',
2020
flags: ['--no-sandbox']
2121
}
22-
},
22+
},*/
2323
singleRun: true
2424
});
2525

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"karma-chai": "^0.1.0",
3535
"karma-chrome-launcher": "^2.0.0",
3636
"karma-coverage": "^1.1.1",
37+
"karma-firefox-launcher": "^1.0.0",
3738
"karma-mocha": "^1.3.0",
3839
"karma-mocha-reporter": "^2.2.2",
3940
"karma-sinon": "^1.0.5",

0 commit comments

Comments
 (0)