Reader small image

You're reading from  Nest.js: A Progressive Node.js Framework

Product typeBook
Published inNov 2019
Reading LevelIntermediate
PublisherPackt
ISBN-139781800204737
Edition1st Edition
Languages
Tools
Right arrow
Authors (5):
Greg Magolan
Greg Magolan
author image
Greg Magolan

Greg Magolan is a senior architect, full-stack engineer, and Angular consultant at Rangle. He has been developing enterprise software solutions for over 15 years for companies such as Agilent Technologies, Electronic Arts, Avigilon, Energy Transfer Partners, FunnelEnvy, Yodel and ACM Facility Safety.
Read more about Greg Magolan

Patrick Housley
Patrick Housley
author image
Patrick Housley

Patrick Housley is a lead technologist at VML. He is an IT professional with over six years of experience in the technology industry. He is capable of analyzing complex issues spanning multiple technologies while providing detailed resolutions and explanations. He has strong front-end development skills with experience leading development teams in maintenance and greenfield projects.
Read more about Patrick Housley

Adrien de Peretti
Adrien de Peretti
author image
Adrien de Peretti

Adrien de Peretti is a full-stack JavaScript developer. He is passionate about new technologies and is constantly looking for new challenges. He is especially interested in artificial intelligence and robotics. W
Read more about Adrien de Peretti

Jay Bell
Jay Bell
author image
Jay Bell

Jay Bell is the CTO of Trellis. He is a senior Angular developer who uses Nest.js in production to develop industry-leading software to help non-profit organizations and charities in Canada. He is a serial entrepreneur who has developed software for a large range of purposes, from helping combat wildfires with drones to building mobile apps.
Read more about Jay Bell

David Guijarro
David Guijarro
author image
David Guijarro

David Guijarro is a front-end developer at Car2go Group GmbH. He has a wide experience working within the JavaScript ecosystem. He has successfully built and led multicultural, multifunctional teams.
Read more about David Guijarro

View More author details
Right arrow

Providers

Providers in Nest are used to create services, factories, helpers, and more that can be injected into controllers and other providers using Nest’s built-in dependency injection. The @Injectable() decorator is used to create a provider class.

The AuthenticationService in our blog application, for example, is a provider that injects and uses the UsersService component.

@Injectable()
export class AuthenticationService {
    constructor(private readonly userService: UserService) {}

    async validateUser(payload: {
        email: string;
        password: string;
    }): Promise<boolean> {
        const user = await this.userService.findOne({
            where: { email: payload.email }
        });
        return !!user;
    }
}

We’ll talk more about dependency injection in the the Dependency Injection chapter.

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Nest.js: A Progressive Node.js Framework
Published in: Nov 2019Publisher: PacktISBN-13: 9781800204737

Authors (5)

author image
Greg Magolan

Greg Magolan is a senior architect, full-stack engineer, and Angular consultant at Rangle. He has been developing enterprise software solutions for over 15 years for companies such as Agilent Technologies, Electronic Arts, Avigilon, Energy Transfer Partners, FunnelEnvy, Yodel and ACM Facility Safety.
Read more about Greg Magolan

author image
Patrick Housley

Patrick Housley is a lead technologist at VML. He is an IT professional with over six years of experience in the technology industry. He is capable of analyzing complex issues spanning multiple technologies while providing detailed resolutions and explanations. He has strong front-end development skills with experience leading development teams in maintenance and greenfield projects.
Read more about Patrick Housley

author image
Adrien de Peretti

Adrien de Peretti is a full-stack JavaScript developer. He is passionate about new technologies and is constantly looking for new challenges. He is especially interested in artificial intelligence and robotics. W
Read more about Adrien de Peretti

author image
Jay Bell

Jay Bell is the CTO of Trellis. He is a senior Angular developer who uses Nest.js in production to develop industry-leading software to help non-profit organizations and charities in Canada. He is a serial entrepreneur who has developed software for a large range of purposes, from helping combat wildfires with drones to building mobile apps.
Read more about Jay Bell

author image
David Guijarro

David Guijarro is a front-end developer at Car2go Group GmbH. He has a wide experience working within the JavaScript ecosystem. He has successfully built and led multicultural, multifunctional teams.
Read more about David Guijarro