Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/muthuri-dev/authentication-authorization-nestjs
Performing auth using nestjs
https://github.com/muthuri-dev/authentication-authorization-nestjs
authentication authorization graphql guard nestjs-backend passport-jwt passport-local
Last synced: 29 minutes ago
JSON representation
Performing auth using nestjs
- Host: GitHub
- URL: https://github.com/muthuri-dev/authentication-authorization-nestjs
- Owner: muthuri-dev
- Created: 2024-07-06T00:34:33.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-06T00:50:15.000Z (7 months ago)
- Last Synced: 2024-11-24T23:09:48.306Z (2 months ago)
- Topics: authentication, authorization, graphql, guard, nestjs-backend, passport-jwt, passport-local
- Language: TypeScript
- Homepage:
- Size: 102 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A progressive guide on nestjs authentication and authorization
## Description
The repo covers mostly on authenticaton and authorization using passportjs and jwt
## Installation
```bash
$ npm install
```## Running the app
```bash
# development
$ npm run start# watch mode
$ npm run start:dev# production mode
$ npm run start:prod
```## Test
```bash
# unit tests
$ npm run test# e2e tests
$ npm run test:e2e# test coverage
$ npm run test:cov
```### schema structure
```bash
input CreateUserInput {
password: String!
username: String!
}type Login {
access_token: String!
user: User!
}input LoginDto {
password: String!
username: String!
}type Mutation {
createUser(userDto: CreateUserInput!): User!
login(loginDto: LoginDto!): Login!
signup(signupDto: LoginDto!): User!
}type Query {
user(username: String!): User!
users: [User!]!
}type User {
id: Int!
username: String!
}
```### connecting graphql
```bash
@Module({
imports: [
GraphQLModule.forRoot({
driver: ApolloDriver,
autoSchemaFile: join(process.cwd(), 'src/schema.gql'),
sortSchema: true,
}),
UsersModule,
AuthModule,
],
providers: [ConfigService],
})
export class AppModule {}```
## Stay in touch
- Author - [Kennedy Muthuri](https://muthuri.vercel.app/)
## License
Nest is [MIT licensed](LICENSE).