-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
194d7f5
commit dd00d3e
Showing
60 changed files
with
2,126 additions
and
428 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# PORT | ||
PORT = 3000 | ||
|
||
# DATABASE | ||
DATABASE_URL= mysql://root:123asd@localhost:3306/dev | ||
|
||
# TOKEN | ||
# JWT secret key | ||
JWT_SECRET=thisisasamplesecret | ||
# Number of minutes after which an access token expires | ||
JWT_ACCESS_EXPIRATION_MINUTES=30 | ||
# Number of days after which a refresh token expires | ||
JWT_REFRESH_EXPIRATION_DAYS=30 | ||
# Number of minutes after which a reset password token expires | ||
JWT_RESET_PASSWORD_EXPIRATION_MINUTES=10 | ||
# Number of minutes after which a verify email token expires | ||
JWT_VERIFY_EMAIL_EXPIRATION_MINUTES=10 | ||
|
||
# LOG | ||
LOG_FORMAT = dev | ||
LOG_DIR = ../logs | ||
|
||
# CORS | ||
ORIGIN = * | ||
CREDENTIALS = true | ||
|
||
# SMTP configuration options for the email service | ||
# For testing, you can use a fake SMTP service like Ethereal: https://ethereal.email/create | ||
SMTP_HOST=email-server | ||
SMTP_PORT=587 | ||
SMTP_USERNAME=email-server-username | ||
SMTP_PASSWORD=email-server-password | ||
EMAIL_FROM=[email protected] |
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 +1,3 @@ | ||
/dist | ||
/dist | ||
node_modules | ||
bin |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Lint | ||
run: npm run lint | ||
|
||
- name: Create .env file | ||
run: cp .env.example .env | ||
|
||
- name: Start functional tests container | ||
run: docker-compose up -d | ||
|
||
- name: Test | ||
run: npm test -- --coverage | ||
|
||
- name: Stop functional tests container | ||
if: always() | ||
run: docker-compose -f "docker-compose.yml" down | ||
|
||
- name: Publish code coverage to Code Climate | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
uses: paambaati/[email protected] | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_REPORTER_ID }} |
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,5 +1,5 @@ | ||
{ | ||
"*.ts": [ | ||
"npm run lint" | ||
"npm run lint:fix" | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
20.10.0 |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// npx ts-node demo/query.ts | ||
import { PrismaClient } from '@prisma/client'; | ||
|
||
const prisma = new PrismaClient(); | ||
|
||
async function main() { | ||
// await prisma.user.create({ | ||
// data: { | ||
// name: 'Alice', | ||
// email: '[email protected]', | ||
// posts: { | ||
// create: { title: 'Hello World' }, | ||
// }, | ||
// profile: { | ||
// create: { bio: 'I like turtles' }, | ||
// }, | ||
// }, | ||
// }); | ||
|
||
// const allUsers = await prisma.user.findMany({ | ||
// include: { | ||
// posts: true, | ||
// profile: true, | ||
// }, | ||
// }); | ||
// console.dir(allUsers, { depth: null }); | ||
|
||
const post = await prisma.post.update({ | ||
where: { id: 1 }, | ||
data: { published: true }, | ||
}); | ||
console.log(post); | ||
} | ||
|
||
main() | ||
.then(async () => { | ||
await prisma.$disconnect(); | ||
}) | ||
.catch(async e => { | ||
console.error(e); | ||
await prisma.$disconnect(); | ||
process.exit(1); | ||
}); |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
version: "3.9" | ||
|
||
services: | ||
proxy: | ||
container_name: proxy | ||
image: nginx:alpine | ||
ports: | ||
- "80:80" | ||
volumes: | ||
- ./nginx.conf:/etc/nginx/nginx.conf | ||
restart: "unless-stopped" | ||
networks: | ||
- backend | ||
|
||
server: | ||
container_name: server | ||
build: | ||
context: ./ | ||
dockerfile: Dockerfile.prod | ||
ports: | ||
- "3000:3000" | ||
environment: | ||
DATABASE_URL: mysql://root:password@localhost:3306/dingding | ||
volumes: | ||
- ./:/app | ||
- /app/node_modules | ||
restart: "unless-stopped" | ||
networks: | ||
- backend | ||
links: | ||
- mysql | ||
depends_on: | ||
- mysql | ||
|
||
mysql: | ||
container_name: mysql | ||
image: mysql:5.7 | ||
environment: | ||
DATABASE_URL: mysql://root:password@localhost:3306/dingding | ||
ports: | ||
- "3306:3306" | ||
networks: | ||
- backend | ||
|
||
networks: | ||
backend: | ||
driver: bridge | ||
|
||
volumes: | ||
data: | ||
driver: local |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM node:20-alpine AS builder | ||
WORKDIR /app | ||
COPY . . | ||
RUN npm pkg delete scripts.prepare | ||
RUN npm install | ||
RUN npm run build | ||
|
||
FROM node:20-alpine | ||
WORKDIR /app | ||
ENV NODE_ENV=production | ||
COPY package*.json ./ | ||
COPY --from=builder ./app/prisma ./ | ||
COPY --from=builder ./app/dist ./dist | ||
RUN npm pkg delete scripts.prepare | ||
RUN npm ci --only=production --quiet | ||
|
||
EXPOSE 3000 | ||
CMD ["node", "./dist/server.js"] |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM node:alpine | ||
|
||
RUN mkdir -p /usr/src/node-app && chown -R node:node /usr/src/node-app | ||
|
||
WORKDIR /usr/src/node-app | ||
|
||
COPY package.json yarn.lock ./ | ||
|
||
USER node | ||
|
||
RUN yarn install --pure-lockfile | ||
|
||
COPY --chown=node:node . . | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,3 +68,7 @@ volumes: | |
dbdata: | ||
cache: | ||
driver: local | ||
|
||
networks: | ||
node-network: | ||
driver: bridge |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: '3.8' | ||
|
||
services: | ||
db: | ||
image: postgres:16-alpine | ||
restart: always | ||
ports: | ||
- '5432:5432' | ||
environment: | ||
POSTGRES_USER: user | ||
POSTGRES_PASSWORD: password | ||
POSTGRES_DB: app |
Oops, something went wrong.