Skip to content

Instantly share code, notes, and snippets.

@steren
Last active Apr 2, 2020
Embed
What would you like to do?
TypeScript to JS
{
"name": "hello-ts",
"version": "1.0.0",
"description": "Hello TS",
"scripts": {
"start": "node server.js",
"gcp-build": "npm run build",
"build": "tsc server.ts"
},
"author": "Steren <steren@google.com>",
"license": "Apache-2.0",
"dependencies": {
"express": "^4.16.2"
},
"devDependencies": {
"typescript": "^2.9.2"
}
}
declare var require: any
declare var process: {
env: {
PORT: string
}
};
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send('🎉 Hello TypeScript! 🎉');
});
const server = app.listen(process.env.PORT || 8080, () => {
const host = server.address().address;
const port = server.address().port;
console.log(`Example app listening at http://${host}:${port}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment