Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(backend): migrate to nestjs #68

Merged
merged 10 commits into from
Jun 3, 2024
Merged
Prev Previous commit
test: finish integration tests for authentication
fix: tests in the ci
  • Loading branch information
tericcabrel committed Jun 3, 2024
commit f4528a9d5782c8bf152be3210c68486ad8938b27
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Run tests
run: |
yarn prisma migrate dev --schema=packages/domain/prisma/schema.prisma
yarn test --runInBand --coverage
yarn test -- --runInBand --coverage

preview-frontend:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions apps/backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ SESSION_LIFETIME=90# 90 days
SENTRY_DSN=
SENTRY_ENABLED=false
SNIPPET_RENDERER_API_URL=http:https://localhost:3000/dev
JWT_SECRET=jwtSecret
1 change: 1 addition & 0 deletions apps/backend/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ SESSION_LIFETIME=90
SENTRY_DSN=sentry-dsn
SENTRY_ENABLED=false
SNIPPET_RENDERER_API_URL=http:https://localhost:3000/dev
JWT_SECRET=jwtSecret
3 changes: 2 additions & 1 deletion apps/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ These packages are located in the folder `packages`, so you might need to change
Here are the packages used in this project:

* [@snipcode/domain](../../packages/domain)
* [@snipcode/logger](../../packages/logger-old)
* [@snipcode/embed](../../packages/embed)
* [@snipcode/utils](../../packages/utils)

## Set up the project
Expand Down Expand Up @@ -67,6 +67,7 @@ nano .env.local
| SENTRY_DSN | Sentry DSN |
| SENTRY_ENABLED | Enable/Disable Sentry |
| SNIPPET_RENDERER_API_URL | Base URL of the API (the current one) for generating the html content from a snippet |
| JWT_SECRET | The secret code for decoding JWT token generated in the application |

Start the application
```bash
Expand Down
1 change: 1 addition & 0 deletions apps/backend/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type EnvironmentVariables = {
GITHUB_CLIENT_SECRET: string;
HOST: string;
INTROSPECTION_ENABLED: string;
JWT_SECRET: string;
NODE_ENV: string;
PORT: string;
REQUEST_TIMEOUT: string;
Expand Down
3 changes: 2 additions & 1 deletion apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"gql:gen:types": "ts-node scripts/generate-graphql-types.ts",
"lint": "eslint \"{src,scripts}/**/*.ts\" --fix",
"prod": "node dist/main",
"test": "yarn workspace @snipcode/domain db:test && dotenv -e .env.test -- jest --watchAll --runInBand",
"test": "yarn workspace @snipcode/domain db:test && dotenv -e .env.test -- jest --runInBand",
"test:watch": "yarn workspace @snipcode/domain db:test && dotenv -e .env.test -- jest --watchAll --runInBand",
"test:coverage": "yarn test --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:it": "yarn test integration.spec.ts"
Expand Down
1 change: 1 addition & 0 deletions apps/backend/src/configs/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const EnvironmentVariablesSchema = z.object({
GITHUB_CLIENT_SECRET: z.string(),
HOST: z.string(),
INTROSPECTION_ENABLED: z.boolean({ coerce: true }),
JWT_SECRET: z.string(),
NODE_ENV: z.union([z.literal('development'), z.literal('production'), z.literal('test')]),
PORT: z.number({ coerce: true }).min(7000).max(8000),
SENTRY_DSN: z.string(),
Expand Down
Loading