Skip to content

Commit

Permalink
fix: improve the typescript sample (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Dec 11, 2018
1 parent 801f853 commit 5406af0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
16 changes: 4 additions & 12 deletions appengine/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/* tslint:disable:no-console */
const PORT = Number(process.env.PORT) || 8080;
import * as express from "express";

declare var process: {
env: {
PORT: string,
},
};
const app = express();

const PORT: number = Number(process.env.PORT) || 8080;
import express = require("express");

const app: any = express();

app.get("/", (req: any, res: any) => {
app.get("/", (req, res) => {
res.send("🎉 Hello TypeScript! 🎉");
});

Expand Down
10 changes: 7 additions & 3 deletions appengine/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
"node": ">=8.0.0"
},
"scripts": {
"test": "npm run gcp-build && npm run lint && repo-tools test app -- index.js",
"lint": "tslint index.ts",
"prepare": "npm run gcp-build",
"pretest": "npm run gcp-build",
"test": "repo-tools test app -- index.js",
"posttest": "npm run lint",
"lint": "tslint -p .",
"start": "node ./index.js",
"gcp-build": "tsc index.ts",
"gcp-build": "tsc -p .",
"deploy": "gcloud app deploy"
},
"dependencies": {
Expand All @@ -21,6 +24,7 @@
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^2.3.3",
"@types/express": "^4.16.0",
"tslint": "^5.11.0"
}
}
9 changes: 9 additions & 0 deletions appengine/typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs"
},
"include": [
"*.ts"
]
}
5 changes: 4 additions & 1 deletion appengine/typescript/tslint.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "tslint:recommended"
"extends": "tslint:recommended",
"rules": {
"no-console": false
}
}

0 comments on commit 5406af0

Please sign in to comment.