Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fatimazbouj/nestjs-authentication-with-passport
https://github.com/fatimazbouj/nestjs-authentication-with-passport
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/fatimazbouj/nestjs-authentication-with-passport
- Owner: fatimazbouj
- Created: 2024-05-09T13:30:12.000Z (8 months ago)
- Default Branch: src
- Last Pushed: 2024-05-13T16:18:02.000Z (8 months ago)
- Last Synced: 2024-11-27T15:37:41.322Z (about 1 month ago)
- Language: TypeScript
- Size: 207 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
A progressive Node.js framework for building efficient and scalable server-side applications.
## Description
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
## 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
```## Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
## Stay in touch
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
- Website - [https://nestjs.com](https://nestjs.com/)
- Twitter - [@nestframework](https://twitter.com/nestframework)## License
Nest is [MIT licensed](LICENSE).
## Authentication Module:
`MongoDb` will be our database for this simple so let's set it up!
### Install MongoDB:
First, you need to install MongoDB on your machine. You can download the MongoDB Community Server from the official MongoDB website: MongoDB Download Center.### Start MongoDB Server:
Once MongoDB is installed, you need to start the MongoDB server.
You can usually start it with the following command:
`mongod`This command will start the MongoDB server on the default port (27017).
### Create a Database:
Next, you'll need to create a database.
You can do this using the MongoDB shell or a MongoDB GUI( Graphical User Interface) client like MongoDB Compass.
`use mydatabase`
Replace mydatabase with the name you want to give to your database.
Create Collections (Optional):
Collections are analogous to tables in a relational database. You can create collections as needed for your application data. Collections are created implicitly when data is inserted into them.Now that you have MongoDB set up and a database created, you can proceed with integrating it into your Nest project following the steps outlined in the previous response. Remember to update the MongoDB connection URI in your configuration file (mongo.config.ts) with the appropriate values for your MongoDB server.
**the MongooseModule** class from the @nestjs/mongoose package.
MongooseModule is a module provided by NestJS for integrating Mongoose with NestJS applications.
It provides utilities for setting up Mongoose connections, defining schemas, and creating Mongoose models.**To use passport-jwt** with Nest, we also need to install @nestjs/jwt.
$ npm install --save @nestjs/jwt passport-jwt
$ npm install --save-dev @types/passport-jwt**insatll passport**
npm i --save @nestjs/passport passport passport-local