initial commit
This commit is contained in:
8
playground/app.vue
Normal file
8
playground/app.vue
Normal file
@ -0,0 +1,8 @@
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
Nuxt module playground!
|
||||
</div>
|
||||
</template>
|
||||
7
playground/nuxt.config.ts
Normal file
7
playground/nuxt.config.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export default defineNuxtConfig({
|
||||
modules: ['../src/module'],
|
||||
|
||||
mongoose: {
|
||||
uri: 'mongodb://127.0.0.1/nuxt-mongoose',
|
||||
},
|
||||
})
|
||||
4
playground/package.json
Normal file
4
playground/package.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "nuxt-mongoose-playground",
|
||||
"private": true
|
||||
}
|
||||
5
playground/server/api/users.get.ts
Normal file
5
playground/server/api/users.get.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { User } from '~/server/models/user.schema'
|
||||
|
||||
export default defineEventHandler(() => {
|
||||
return User.find()
|
||||
})
|
||||
18
playground/server/models/user.schema.ts
Normal file
18
playground/server/models/user.schema.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { defineMongooseModel } from '#nuxt/mongoose'
|
||||
|
||||
export const User = defineMongooseModel({
|
||||
name: 'User',
|
||||
schema: {
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// export const User = defineMongooseModel('User', {
|
||||
// name: {
|
||||
// type: String,
|
||||
// required: true,
|
||||
// },
|
||||
// })
|
||||
Reference in New Issue
Block a user