This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory" CentOS's and Fedora +22 workaround | |
Install `redhat-rpm-config` | |
$ sudo dnf install redhat-rpm-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require( "express" ); | |
const port = process.env.PORT || 3000; | |
const logRequest = (req, res, next) => { | |
console.log(req); | |
next(); | |
} | |
const app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "express_api", | |
"version": "1.0.0", | |
"description": "", | |
"main": "src/index.js", | |
"scripts": { | |
"start": "node .", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "express_api", | |
"version": "1.0.0", | |
"description": "", | |
"main": "src/index.js", | |
"scripts": { | |
"prestart": "tsc -p .", | |
"start": "node dist/index.js", | |
"dev": "ts-node-dev src/index.ts", | |
"build": "tsc -p .", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express, {Application, Request, Response, NextFunction} from 'express'; | |
const port = Number(process.env.PORT || 3000); | |
const logRequest = (req: Request, res: Response, next: NextFunction) => { | |
console.log(req); | |
next(); | |
} | |
const app: Application = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node | |
WORKDIR /app | |
COPY . . | |
RUN npm i | |
EXPOSE 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:14-alpine AS node | |
# Builder stage | |
FROM node AS builder | |
# Use /app as the CWD | |
WORKDIR /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Final stage | |
FROM node AS final | |
# Prepare destination directory and ensure user node owns it | |
RUN mkdir -p /home/node/app/dist && chown -R node:node /home/node/app | |
# Set CWD | |
WORKDIR /home/node/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apps: | |
- name: express-typescript-api | |
script: ./dist/index.js | |
exec_mode: cluster | |
instances: max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Final stage | |
FROM node AS final | |
# Set node environment to production | |
ENV NODE_ENV production | |
# Prepare destination directory and ensure user node owns it | |
RUN mkdir -p /home/node/app/dist && chown -R node:node /home/node/app |
OlderNewer