-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
361 additions
and
406 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
FROM node:20 | ||
FROM node:20-slim AS base | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
|
||
ENV NODE_ENV=PRODUCTION | ||
# Install app dependencies | ||
# A wildcard is used to ensure both package.json AND package-lock.json are copied | ||
COPY package*.json ./ | ||
RUN corepack enable | ||
COPY . /app | ||
WORKDIR /app | ||
|
||
# building your code for production | ||
RUN npm ci --only=production --ignore-scripts | ||
FROM base AS prod-deps | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile | ||
|
||
# Bundle app source | ||
COPY . . | ||
FROM base | ||
COPY --from=prod-deps /app/node_modules /app/node_modules | ||
|
||
EXPOSE 8080 | ||
CMD [ "npm", "start" ] | ||
CMD [ "pnpm", "start" ] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ const sse = (req, res) => { | |
() => { | ||
clearInterval(interval); | ||
}, | ||
false | ||
false, | ||
); | ||
}; | ||
|
||
|
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,46 @@ | ||
{ | ||
"name": "node-express-example", | ||
"version": "0.0.1", | ||
"private": true, | ||
"exports": "./app.js", | ||
"type": "module", | ||
"engines": { | ||
"node": ">=14.16" | ||
"node": ">=16" | ||
}, | ||
"author": "Lawrence Li", | ||
"homepage": "https://github.com/Lonor/node-express-example", | ||
"author": "Lawrence Li @la3rence", | ||
"homepage": "https://github.com/la3rence/node-express-example", | ||
"license": "MIT", | ||
"lint-staged": { | ||
"**/*": "prettier --write --ignore-unknown" | ||
}, | ||
"scripts": { | ||
"dev": "pnpm run swagger; pnpm start", | ||
"dev": "pnpm swagger; pnpm start", | ||
"start": "node server.js", | ||
"test": "mocha --timeout 10000 --exit --reporter mocha-junit-reporter", | ||
"test:coverage": "c8 --reporter=lcov -r html -r text pnpm test", | ||
"test:grep": "pnpm test -- -g", | ||
"swagger": "node ./swagger/autogen.js && pnpm run format", | ||
"format": "prettier --write . --ignore-unknown", | ||
"swagger": "node ./swagger/autogen.js && pnpm fmt", | ||
"fmt": "prettier --write . --ignore-unknown", | ||
"test:fmt": "prettier --check .", | ||
"prepare": "husky install" | ||
}, | ||
"dependencies": { | ||
"dotenv": "16.0.3", | ||
"dotenv": "^16.3.1", | ||
"express": "4.18.2", | ||
"express-winston": "4.2.0", | ||
"node-fetch": "3.3.1", | ||
"swagger-ui-express": "4.6.3", | ||
"winston": "3.9.0" | ||
"express-winston": "^4.2.0", | ||
"node-fetch": "^3.3.2", | ||
"swagger-ui-express": "^5.0.0", | ||
"winston": "^3.11.0" | ||
}, | ||
"devDependencies": { | ||
"c8": "7.14.0", | ||
"chai": "4.3.7", | ||
"husky": "8.0.3", | ||
"lint-staged": "13.2.2", | ||
"mocha": "10.2.0", | ||
"mocha-junit-reporter": "2.2.0", | ||
"prettier": "2.8.8", | ||
"supertest": "6.3.3", | ||
"swagger-autogen": "2.23.1" | ||
"c8": "^8.0.1", | ||
"chai": "^5.0.0", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.3.0", | ||
"mocha": "^10.2.0", | ||
"mocha-junit-reporter": "^2.2.1", | ||
"prettier": "^3.1.1", | ||
"supertest": "^6.3.3", | ||
"swagger-autogen": "^2.23.7" | ||
} | ||
} |
Oops, something went wrong.
2dcabc7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
express-example – ./
node.lawrenceli.vercel.app
express-example-git-main-lawrenceli.vercel.app
node.lawrenceli.me
express-example-lawrenceli.vercel.app