0.1.0 • Published 1 year ago

nestjs-basic-auth v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Overview

By using this package, you can place a basic auth on any address in the NestJS framework to prevent unauthorized access.

For example, you can set a username and password to the Swagger document.

Getting Started

npm install nestjs-basic-auth

or

yarn add nestjs-basic-auth

Example

The module exports a function that, when called with an options object, returns the middleware.

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { basicAuth } from 'nestjs-basic-auth';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  app.use(
    ['/docs'],
    basicAuth({
      challenge: true,
      users: { admin: 'password' },
    }),
  );

  await app.listen(3000);
}
bootstrap();
0.1.0

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago