GithubHelp home page GithubHelp logo

vuhoi / dryerjs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dryerjs/dryerjs

0.0 0.0 0.0 1.4 MB

The fastest way to build a GraphQL API with NestJS and Mongoose

Home Page: https://dryerjs.com

License: MIT License

Shell 0.06% JavaScript 13.63% TypeScript 86.30%

dryerjs's Introduction

DryerJS Logo

DryerJS, built on NestJS with Mongoose, is a robust tool for creating CRUD GraphQL APIs. It allows for declarative model declaration, supports model relations, and is easily customizable, thus enhancing API development and minimizing repetitive coding.

codecov Build Status Release Status npm Discord Paypal

Documentation

Checkout the documentation at dryerjs.com for more information.

Getting Started

To get started with DryerJS, follow these steps:

  1. Prepare:

    # install @nestjs/cli and create a new project
    npm i -g @nestjs/cli && nest new my-project && cd my-project
    # install standard dependencies
    npm i @nestjs/graphql @nestjs/apollo class-transformer class-validator @nestjs/mongoose
    # remove unrelated files
    rm -rf src/app.controller.ts src/app.service.ts src/app.controller.spec.ts
    # install dataloader
    npm i dataloader
  2. Install DryerJS:

    npm i dryerjs
  3. Declare your first model on src/user.ts:

    import { Definition, Property, Id, Skip } from 'dryerjs';
    
    @Definition()
    export class User {
      @Id()
      id: string;
    
      @Property()
      email: string;
    
      @Property({ update: Skip, output: Skip })
      password: string;
    
      @Property()
      name: string;
    }
  4. Import your model and DryerJSModule in AppModule with other modules inside app.module.ts:

    import { Module } from '@nestjs/common';
    import { GraphQLModule } from '@nestjs/graphql';
    import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
    import { MongooseModule } from '@nestjs/mongoose';
    import { DryerModule } from 'dryerjs';
    
    import { User } from './user';
    
    @Module({
      imports: [
        GraphQLModule.forRoot<ApolloDriverConfig>({
          driver: ApolloDriver,
          autoSchemaFile: true,
          playground: true,
        }),
        MongooseModule.forRoot('mongodb://127.0.0.1:27017/test'),
        DryerModule.register({ definitions: [User] }),
      ],
    })
    export class AppModule {}
  5. Start server

    npm run start:dev
  6. Open browser and go to http://localhost:3000/graphql to see the GraphQL playground.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE file for details.

dryerjs's People

Contributors

vanpho93 avatar semantic-release-bot avatar luongtrieuvy202 avatar tuanvu0995 avatar gibanguyen avatar bachhm-dev avatar sherloach avatar phuvinhbmt avatar jaynguyen-vn avatar kael2312 avatar liucuxiu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.