0.1.0 • Published 12 months ago

nestjs-basic-auth v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months 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

12 months ago

0.0.12

12 months ago

0.0.11

12 months ago

0.0.10

12 months ago

0.0.9

12 months ago

0.0.8

12 months ago

0.0.7

12 months ago

0.0.6

12 months ago

0.0.5

12 months ago

0.0.4

12 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago

0.0.0

12 months ago