44 lines
855 B
Markdown
44 lines
855 B
Markdown
# Setup
|
|
|
|
A Nuxt module for simplifying the use of Mongoose in your project.
|
|
|
|
## Installation
|
|
|
|
1. Install `nuxt-mongoose` to your dependencies.
|
|
```bash
|
|
npx nuxi@latest module add nuxt-mongoose
|
|
```
|
|
|
|
2. Add `nuxt-mongoose` to the `modules` section of your `nuxt.config` file.
|
|
|
|
```ts [nuxt.config]
|
|
export default defineNuxtConfig({
|
|
modules: [
|
|
'nuxt-mongoose',
|
|
],
|
|
})
|
|
```
|
|
|
|
::alert{ type=success }
|
|
That's it! You can now use Mongoose in your Nuxt app ✨
|
|
::
|
|
|
|
|
|
## Options
|
|
|
|
You can configure the module by adding a `mongoose` section to your `nuxt.config` file.
|
|
read more about [Mongoose options](/docs/getting-started/configuration).
|
|
|
|
```ts [nuxt.config]
|
|
export default defineNuxtConfig({
|
|
mongoose: {
|
|
// Options
|
|
},
|
|
})
|
|
```
|
|
If you want to configure only the `uri` just add `MONGODB_URI` in your `.env` file.
|
|
|
|
```env
|
|
MONGODB_URI=YOUR_MONGO_URI
|
|
```
|