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

add auth with its tests #19

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LOCAL_MONGODB_URI=mongodb://admin:password@localhost:27017/dev_database?authSource=admin

JWT_SECRET=your_jwt_secret_key_here
JWT_EXPIRATION=8h

PORT=3000
27 changes: 0 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,3 @@ jobs:
name: test-coverage
path: 'coverage/apps/**'

e2e:
runs-on: ubuntu-latest
needs: lint-and-build
services:
mongodb:
image: mongo:4.4
ports:
- 27017:27017
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci --legacy-peer-deps
- name: Install Xvfb
run: sudo apt-get update && sudo apt-get install -y xvfb
- name: Run E2E Tests
run: |
xvfb-run --auto-servernum npx nx run server:serve &
sleep 10 # Give the server some time to start
xvfb-run --auto-servernum npx nx run-many --target=e2e --all
- uses: actions/upload-artifact@v3
with:
name: e2e-results
path: cypress/videos/**

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ testem.log
# System Files
.DS_Store
Thumbs.db

.env
.nx/cache
.nx/workspace-data

Expand Down
10 changes: 0 additions & 10 deletions apps/client-e2e/.eslintrc.json

This file was deleted.

17 changes: 0 additions & 17 deletions apps/client-e2e/cypress.config.ts

This file was deleted.

10 changes: 0 additions & 10 deletions apps/client-e2e/project.json

This file was deleted.

13 changes: 0 additions & 13 deletions apps/client-e2e/src/e2e/app.cy.ts

This file was deleted.

5 changes: 0 additions & 5 deletions apps/client-e2e/src/fixtures/example.json

This file was deleted.

1 change: 0 additions & 1 deletion apps/client-e2e/src/support/app.po.ts

This file was deleted.

35 changes: 0 additions & 35 deletions apps/client-e2e/src/support/commands.ts

This file was deleted.

17 changes: 0 additions & 17 deletions apps/client-e2e/src/support/e2e.ts

This file was deleted.

24 changes: 0 additions & 24 deletions apps/client-e2e/tsconfig.json

This file was deleted.

18 changes: 0 additions & 18 deletions apps/server-e2e/.eslintrc.json

This file was deleted.

19 changes: 0 additions & 19 deletions apps/server-e2e/jest.config.ts

This file was deleted.

17 changes: 0 additions & 17 deletions apps/server-e2e/project.json

This file was deleted.

10 changes: 0 additions & 10 deletions apps/server-e2e/src/server/server.spec.ts

This file was deleted.

10 changes: 0 additions & 10 deletions apps/server-e2e/src/support/global-setup.ts

This file was deleted.

7 changes: 0 additions & 7 deletions apps/server-e2e/src/support/global-teardown.ts

This file was deleted.

10 changes: 0 additions & 10 deletions apps/server-e2e/src/support/test-setup.ts

This file was deleted.

13 changes: 0 additions & 13 deletions apps/server-e2e/tsconfig.json

This file was deleted.

9 changes: 0 additions & 9 deletions apps/server-e2e/tsconfig.spec.json

This file was deleted.

33 changes: 33 additions & 0 deletions apps/server/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { MongooseModule } from '@nestjs/mongoose';
import { AuthModule } from './auth/auth.module';

@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
envFilePath: '.env',
}),
MongooseModule.forRootAsync({
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => {
const nodeEnv = configService.get<string>('NODE_ENV', 'development');
let uri: string;

switch (nodeEnv) {
case 'production':
uri = configService.get<string>('PROD_MONGODB_URI')!;
break;
default:
uri = configService.get<string>('DEV_MONGODB_URI')!;
}

return { uri };
},
inject: [ConfigService],
}),
AuthModule,
],
})
export class AppModule {}
22 changes: 0 additions & 22 deletions apps/server/src/app/app.controller.spec.ts

This file was deleted.

13 changes: 0 additions & 13 deletions apps/server/src/app/app.controller.ts

This file was deleted.

11 changes: 0 additions & 11 deletions apps/server/src/app/app.module.ts

This file was deleted.

Loading
Loading