Examples

Examples & Recipes

Real-world examples to help you build amazing applications with wexts.

🔐 Authentication Example

auth.service.tstypescript
1@Injectable()
2export class AuthService {
3 async login(email: string, password: string) {
4 const user = await this.prisma.user.findUnique({
5 where: { email },
6 });
7
8 if (!user || !(await bcrypt.compare(password, user.password))) {
9 throw new UnauthorizedException();
10 }
11
12 const token = this.jwt.sign({ sub: user.id });
13 return { user, token };
14 }
15}

Type Safety

Notice full autocomplete for wexts.auth.login()!

More Examples

  • CRUD Operations
  • File Upload
  • Real-time Features
  • Email Integration