Skip to content

Commit 7721c73

Browse files
committed
Refresh async-ts
1 parent 460a3fb commit 7721c73

18 files changed

+425
-91
lines changed

TypeScriptAsyncAwait/async-await-basics/app.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function sleep(seconds: number) : Promise<void> {
1515

1616
function getPokemonName(pokemonId: number): Promise<string> {
1717
return new Promise<string>((resolve, reject) => {
18-
needle.get(`http://pokeapi.co/api/v2/pokemon/${pokemonId}/`, (err, res) => {
18+
needle.get(`https://pokeapi.co/api/v2/pokemon/${pokemonId}/`, (err, res) => {
1919
if (!err && res.statusCode == 200) {
2020
let pokemon = <IPokemon>res.body;
2121
resolve(pokemon.forms[0].name);

TypeScriptAsyncAwait/async-await-basics/package-lock.json

+64
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TypeScriptAsyncAwait/async-await-basics/package.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"start": "tsc && node ./dist/app.js"
88
},
99
"author": "",
10-
"license": "ISC"
10+
"license": "ISC",
11+
"dependencies": {
12+
"needle": "^2.2.4"
13+
},
14+
"devDependencies": {
15+
"@types/needle": "^2.0.2"
16+
}
1117
}

TypeScriptAsyncAwait/async-await-basics/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"target": "es2015",
55
"noImplicitAny": false,
66
"sourceMap": false,
7-
"moduleResolution": "node"
7+
"moduleResolution": "node",
8+
"outDir": "dist"
89
},
910
"exclude": [
1011
"node_modules"

TypeScriptAsyncAwait/async-await-basics/typings.json

-8
This file was deleted.

TypeScriptAsyncAwait/async-await/app.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import * as mongodb from 'mongodb';
2525

2626
async function run() {
2727
// Open Database
28-
var client = await mongodb.MongoClient.connect('mongodb://10.0.75.2:27017');
28+
var client = await mongodb.MongoClient.connect('mongodb://10.0.75.2:27017', { useNewUrlParser: true });
2929
var db = client.db('demo');
3030

3131
// Read all persons with first name "John"

TypeScriptAsyncAwait/async-await/package-lock.json

+59-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TypeScriptAsyncAwait/async-await/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"description": "",
55
"main": "app.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"start": "tsc && node ./dist/app.js"
88
},
99
"author": "",
1010
"license": "ISC",
1111
"dependencies": {
1212
"@types/mongodb": "^3.0.18",
1313
"mongodb": "^3.0.0",
14-
"typescript": "^2.8.3"
14+
"typescript": "^3.1.3"
1515
}
1616
}

TypeScriptAsyncAwait/async-await/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"target": "es2015",
55
"noImplicitAny": false,
66
"sourceMap": false,
7-
"moduleResolution": "node"
7+
"moduleResolution": "node",
8+
"outDir": "dist"
89
},
910
"exclude": [
1011
"node_modules"

TypeScriptAsyncAwait/async-js/app.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async.waterfall(
3131
[
3232
// Open Database
3333
callback =>
34-
mongodb.MongoClient.connect('mongodb://localhost:27017', callback),
34+
mongodb.MongoClient.connect('mongodb://localhost:27017', { useNewUrlParser: true }, callback),
3535

3636
// Read all persons with first name "John"
3737
(cli, callback) => {

0 commit comments

Comments
 (0)