Created
August 5, 2024 14:09
-
-
Save nsdevaraj/a41fb09683c3055ab25e7a2c43a15dba to your computer and use it in GitHub Desktop.
Prevention of Injection Attacks
This file contains hidden or 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
import { getRepository } from 'typeorm'; | |
import { User } from './entity/User'; | |
async function getUser(username: string): Promise<User | undefined> { | |
const userRepository = getRepository(User); | |
return await userRepository.findOne({ where: { username } }); | |
} | |
// Usage | |
const user = await getUser(username); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment