topfullstack / Nestjs Mongoose Crud
Nest.js crud module for mongoose models without `nestjsx/crud`
Stars: ✭ 164
Programming Languages
typescript
32286 projects
Projects that are alternatives of or similar to Nestjs Mongoose Crud
Jianshu
仿简书nx+nodejs+nestjs6+express+mongodb+angular8+爬虫
Stars: ✭ 296 (+80.49%)
Mutual labels: restful-api, mongoose, crud, nestjs
Nodepress
😎 RESTful API service for Blog/CMS, powered by @nestjs
Stars: ✭ 829 (+405.49%)
Mutual labels: restful-api, mongoose, nestjs
nestjs-rest-sample
NestJS RESTful APIs Sample
Stars: ✭ 204 (+24.39%)
Mutual labels: mongoose, restful-api, nestjs
server-next
😎 The next generation of RESTful API service and more for Mix Space, powered by @nestjs.
Stars: ✭ 43 (-73.78%)
Mutual labels: mongoose, restful-api, nestjs
Nest Angular
NestJS, Angular 6, Server Side Rendering (Angular Universal), GraphQL, JWT (JSON Web Tokens) and Facebook/Twitter/Google Authentication, Mongoose, MongoDB, Webpack, TypeScript
Stars: ✭ 307 (+87.2%)
Mutual labels: mongoose, nestjs
Forms Angular
Probably the most opinionated framework in the world
Stars: ✭ 412 (+151.22%)
Mutual labels: mongoose, crud
Flask Vue Crud
Single Page App with Flask and Vue.js
Stars: ✭ 467 (+184.76%)
Mutual labels: restful-api, crud
Rest Hapi
🚀 A RESTful API generator for Node.js
Stars: ✭ 1,102 (+571.95%)
Mutual labels: mongoose, crud
Mean Stack Angular6 Crud Example
MEAN Stack Angular 6 CRUD Web Application
Stars: ✭ 69 (-57.93%)
Mutual labels: mongoose, crud
Node Blog
🔥✨ A react blog project base on nodejs, nestjs, mongoose, typescript, react, ant-design,nextjs
Stars: ✭ 69 (-57.93%)
Mutual labels: mongoose, nestjs
Nauth Restful Api
Node.js+Mongoose的RestfulApi的用户token权限验证(just a demo)
Stars: ✭ 155 (-5.49%)
Mutual labels: restful-api, mongoose
Nestjs Boilerplate
NestJS Boilerplate 😻(Authentication, TypeORM, Configuration, Swagger)
Stars: ✭ 267 (+62.8%)
Mutual labels: restful-api, nestjs
Ecommerce Nodejs
Ecommerce application back-end codes
Stars: ✭ 97 (-40.85%)
Mutual labels: restful-api, mongoose
Books-Library-API
A starter template for building a restful API with nestjs, nodejs , expressjs , monogdb, mongoose
Stars: ✭ 21 (-87.2%)
Mutual labels: mongoose, nestjs
Appy Backend
A user system to bootstrap your app.
Stars: ✭ 96 (-41.46%)
Mutual labels: restful-api, mongoose
Nest Cnode
CNode 社区 Nest 版本 https://cnodejs.org/
Stars: ✭ 125 (-23.78%)
Mutual labels: mongoose, nestjs
Nest User Auth
A starter build for a back end which implements managing users with MongoDB, Mongoose, NestJS, Passport-JWT, and GraphQL.
Stars: ✭ 145 (-11.59%)
Mutual labels: mongoose, nestjs
ack-nestjs-mongoose
NestJs Boilerplate. Authentication (OAuth2), Mongoose, MongoDB , Configuration, Multi Languages (i18n), etc. Advance Example 🥶. NestJs v8 🥳🎉. Production Ready 🚀🔥
Stars: ✭ 81 (-50.61%)
Mutual labels: mongoose, nestjs
NestJs + Mongoose CRUD
Nest.js crud module for mongoose models without @nestjsx/crud
Important
- NestJs 6.x ----> nestjs-mongoose-crud v1.x
- NestJs 7.x ----> nestjs-mongoose-crud v2.x
- fix #7
Nest.js + Typegoose 中文视频教程请移步哔哩哔哩: 全栈之巅
Usage
-
Install and setup nestjs-typegoose or nestjs-mongoose
-
Install
yarn add nestjs-mongoose-crud # or npm i nestjs-mongoose-crud
-
Import model to module:
import { Module } from '@nestjs/common'; import { UsersController } from './users.controller'; import { TypegooseModule } from 'nestjs-typegoose'; import { User } from './user.model'; @Module({ imports: [ TypegooseModule.forFeature([User]) ], controllers: [UsersController] }) export class UsersModule {}
-
Add
@Crud()
decorator and inject imported model tomodel
property.import { Controller } from '@nestjs/common'; import { Crud } from 'nestjs-mongoose-crud' import { User } from './user.model'; import { InjectModel } from 'nestjs-typegoose'; import { ModelType } from '@typegoose/typegoose/lib/types'; @Crud({ model: User }) @Controller('users') export class UsersController { constructor(@InjectModel(User) public model: ModelType<User>) {} }
-
Test your CRUD APIs: http://localhost:3000/users
APIs
e.g. @Crud()
for UsersController
METHOD | PATH | DESC |
---|---|---|
GET | /users | Get all users |
GET | /users/:id | Get a user |
POST | /users | Create a user |
PUT | /users/:id | update a user |
DELETE | /users/:id | Delete a user |
You can find all routes and DTOs by setup swagger
Query
Use a JSON (in string) query
parameter to find records:
Interfaces
export interface PaginateKeys {
data?: string
total?: string
lastPage?: string
currentPage?: string
}
export interface CrudRoute {
decorators?: MethodDecorator[]
}
export interface CrudRouteWithDto extends CrudRoute {
dto?: any
transform?: (data: any) => any
}
export interface CrudRouteForFind extends CrudRoute {
paginate?: PaginateKeys | false
limit?: number
populate?: string | any
sort?: string | any
where?: any
}
export interface CrudRouteForFindOne extends CrudRoute {
populate?: string | any
where?: any
select?: any
}
export interface CrudRoutes {
grid?: false,
form?: false,
find?: CrudRouteForFind | false,
findOne?: CrudRouteForFindOne | false,
create?: CrudRouteWithDto | false,
update?: CrudRouteWithDto | false,
delete?: CrudRoute | false,
}
export interface CrudOptions {
routes?: CrudRoutes
}
export interface OptionItem {
text: string
value: string
}
export interface Field {
label?: string
icon?: string
type?: 'hide' | 'text' | 'input' | 'autocomplete' | 'textarea' | 'number' | 'checkbox' | 'checkbox-button' | 'radio' | 'date' | 'dates' | 'week' | 'month' | 'year' | 'daterange' | 'time' | 'datetime' | 'datetimerange' | 'switch' | 'yesno' | 'slider' | 'password' | 'color' | 'select' | 'cascader' | 'transfer' | 'rate' | 'tag' | 'image' | 'button' | 'json-editor' | 'upload-file' | 'image-uploader' | 'tree-select' | 'video-uploader' | 'quill-editor' | 'markdown-editor' | 'bmap' | 'codemirror' | 'gallery'
listable?: boolean
editable?: boolean
attrs?: any
layout?: number
tip?: string
options?: OptionItem[]
class?: string | string[]
style?: any
width?: string | number
[key: string]: any
column?: Field[]
}
export interface Fields {
[key: string]: Field
}
export interface AvueCrudOption {
addBtn?: boolean
addRowBtn?: boolean
align?: string
border?: boolean
calcHeight?: number
cancelBtnTitle?: string
columnBtn?: boolean
dataType?: string
cellBtn?: boolean
dateBtn?: boolean
cancelBtn?: boolean
dateDefault?: boolean
dicData?: any
dicMethod?: string
dicQuery?: any
dicUrl?: string
delBtn?: boolean
defaultSort?: any
dialogFullscreen?: boolean
dialogEscape?: boolean
dialogClickModal?: boolean
dialogCloseBtn?: boolean
dialogModal?: boolean
dialogTop?: string | number
dialogType?: string
dialogWidth?: string | number
dialogHeight?: string | number
defaultExpandAll?: boolean
expandRowKeys?: string[]
editBtn?: boolean
emptyText?: string
expand?: boolean
expandWidth?: number
expandFixed?: boolean
excelBtn?: boolean
filterBtn?: boolean
formWidth?: string | number
height?: number
header?: boolean
index?: boolean
indexLabel?: string
indexWidth?: number
indexFixed?: boolean
rowKey?: string
indeterminate?: boolean
labelWidth?: number
maxHeight?: number
menu?: boolean
menuWidth?: number
menuXsWidth?: number
menuAlign?: string
menuType?: string
menuBtnTitle?: string
pageSize?: string
pageSizes?: number[]
printBtn?: boolean
refreshBtn?: boolean
saveBtn?: boolean
updateBtn?: boolean
cancalBtn?: boolean
saveBtnTitle?: string
selection?: boolean
selectionWidth?: number
selectionFixed?: boolean
searchBtn?: boolean
selectable?: boolean
reserveSelection?: true
selectClearBtn?: boolean
showHeader?: boolean
showSummary?: boolean
size?: string
sumColumnList?: string[]
stripe?: boolean
tip?: string
tipPlacement?: string
title?: string
checkStrictly?: boolean
updateBtnTitle?: string
viewBtn?: boolean
width?: number
column?: Field[]
group?: Field[]
}
export interface AvueCrudConfig {
option?: AvueCrudOption
[key: string]: any
}
export interface CrudOptionsWithModel extends CrudOptions {
name?: string | string[],
model: any
fields?: Fields
config?: ((instance?: any) => AvueCrudConfig | Promise<AvueCrudConfig>) | AvueCrudConfig
}
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].