Skip to content

Instantly share code, notes, and snippets.

View angellandros's full-sized avatar

Mohammad-Ali A'râbi angellandros

  • AppTec Services GmbH
  • Freiburg im Breisgau
View GitHub Profile
@angellandros
angellandros / main.ts
Created October 19, 2019 02:09
Sample Express.js TypeScript app with HTTPS
import * as express from 'express';
import * as fs from 'fs';
import * as https from 'https';
import { RegisterRoutes } from './routes/routes';
const privateKey = fs.readFileSync('cert/cert.key');
const certificate = fs.readFileSync('cert/cert.crt');
const credentials = {key: privateKey, cert: certificate};
const app = express();
@angellandros
angellandros / package.json
Created October 19, 2019 02:25
Sample package.json scripts for TSOA
{
...
"scripts": {
"build:routes": "mkdir -p src/routes && tsoa routes",
"build:swagger": "mkdir -p api && mkdir -p api/dist && tsoa swagger",
"build:ts": "tsc -p src",
"build:all": "npm run build:routes && npm run build:swagger && npm run build:ts",
"server": "node dist/main.js",
"lint": "tslint -c tslint.json 'src/**/*.ts'"
},
@angellandros
angellandros / Dockerfile
Last active October 19, 2019 02:32
Sample Dockerfile for Express.js app
FROM node:12.10
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
RUN npm install
COPY . /usr/src/app
RUN npm run build:all
@angellandros
angellandros / docker-compose.yaml
Last active February 23, 2020 11:50
Sample Docker-Compose config file for Express.js with TSOA and Swagger UI
version: "3.2"
services:
web:
image: aerabi/express-ts
build: .
ports:
- "3000:3000"
environment:
NODE_ENV : docker
volumes: