Skip to content

Commit 2c5f711

Browse files
committed
update to dinoloop v2.1.x
1 parent 25e5032 commit 2c5f711

File tree

6 files changed

+47
-10
lines changed

6 files changed

+47
-10
lines changed

.vscode/launch.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "DinoloopStarter",
11+
"program": "${workspaceFolder}/src\\app\\app.ts",
12+
"preLaunchTask": "debugger_starter",
13+
"outFiles": [
14+
"${workspaceFolder}/dist/**/*.js"
15+
]
16+
}
17+
]
18+
}

.vscode/tasks.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "debugger_starter",
8+
"type": "npm",
9+
"script": "build",
10+
"problemMatcher": []
11+
}
12+
]
13+
}

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "dinoloop-starter",
33
"version": "1.0.0",
44
"private": true,
5-
"description": "Dinoloop starter featuring typescript and express",
5+
"description": "Dinoloop starter featuring typescript and expressjs",
66
"homepage": "https://github.com/ParallelTask/dinoloop-starter",
77
"author": "Dinoloop Team",
88
"license": "MIT",
@@ -16,12 +16,12 @@
1616
},
1717
"dependencies": {
1818
"body-parser": "^1.18.3",
19-
"dinoloop": "^1.0.0",
19+
"dinoloop": "^2.1.0",
2020
"express": "^4.16.3"
2121
},
2222
"devDependencies": {
2323
"@types/express": "^4.11.1",
24-
"@types/node": "^7.0.22",
24+
"@types/node": "^10.0.22",
2525
"rimraf": "^2.5.2",
2626
"typescript": "~2.4.2"
2727
},

src/app/app.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ import { Dino } from 'dinoloop';
44
import { HomeController } from './controllers/home.controller';
55

66
const app = express();
7+
const port = process.env.PORT || 8088;
78

89
/************ basic express-setup **************/
910
app.use(bodyParser.json());
1011

1112
// Dino requires express app instance
1213
// and the base-uri on which dino app to be mounted
13-
let dino = new Dino(app, '/api');
14+
const dino = new Dino(app, '/api');
1415

1516
dino.useRouter(() => express.Router());
1617
dino.registerController(HomeController);
17-
1818
dino.bind();
19-
app.listen(8088, () => console.log('Server started on port 8088'));
19+
20+
app.listen(port, () => console.log(`Server started on port ${port}`));
+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ApiController, Controller, HttpGet } from 'dinoloop';
1+
import { ApiController, Controller, HttpGet, BindNumber } from 'dinoloop';
22

33
@Controller('/home')
44
export class HomeController extends ApiController {
@@ -7,4 +7,9 @@ export class HomeController extends ApiController {
77
get(): string {
88
return 'Hello World!';
99
}
10+
11+
@HttpGet('/user/:id')
12+
user(@BindNumber() id: number): number {
13+
return id;
14+
}
1015
}

tsconfig.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
3+
"target": "es6",
44
"module": "commonjs",
55
"moduleResolution": "node",
66
"emitDecoratorMetadata": true,
77
"experimentalDecorators": true,
8+
"sourceMap": true,
89
"lib": [
9-
"es2017",
10-
"es2015"
10+
"es2017"
1111
],
1212
"typeRoots": [
1313
"node_modules/@types"

0 commit comments

Comments
 (0)