Giter Site home page Giter Site logo

lehuuphuc / nestjs-api-mongoose Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tony133/nestjs-apps-collection

0.0 0.0 0.0 4.14 MB

Simple example Api Rest with Nestjs 8.x and Mongoose ๐Ÿ˜ป

License: MIT License

JavaScript 1.32% TypeScript 98.58% Shell 0.10%

nestjs-api-mongoose's Introduction

nestjs-api-mongoose

Simple example Api Rest with Nestjs 8.x and Mongoose ๐Ÿ˜ป

Installation

$ npm install

Set environment

$ cp .env.example .env

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Docker

There is a docker-compose.yml file for starting MongoDB with Docker.

$ docker-compose up

After running, you can stop the Docker container with

$ docker-compose down

Url Swagger for Api Documentation

http://127.0.0.1:3000/api/doc

Getting with Curl Customers

    $ curl -H 'content-type: application/json' -v -X GET http://127.0.0.1:3000/api/customers  
    $ curl -H 'content-type: application/json' -v -X GET http://127.0.0.1:3000/api/customers/:id 
    $ curl -H 'content-type: application/json' -v -X POST -d '{"firstName": "firstName #1", "lastName": "lastName #1", "email": "[email protected]", "phone": "1234567890", "address": "street 1","description": "Lorem ipsum", "organizations": ":OrganizationId"}' http://127.0.0.1:3000/api/customers 
    $ curl -H 'content-type: application/json' -v -X PUT -d '{"firstName": "firstName #1", "lastName": "lastName #1", "email": "[email protected]", "phone": "1234567890", "address": "street 1","description": "Lorem ipsum", "organizations": ":OrganizationId"}' http://127.0.0.1:3000/api/customers/:id 
    $ curl -H 'content-type: application/json' -v -X DELETE http://127.0.0.1:3000/api/customers/:id 

Getting with Curl Organizations

    $ curl -H 'content-type: application/json' -v -X GET http://127.0.0.1:3000/api/organizations  
    $ curl -H 'content-type: application/json' -v -X GET http://127.0.0.1:3000/api/organizations/:id 
    $ curl -H 'content-type: application/json' -v -X POST -d '{"name":"Foo bar", "address": "street 1", "description": "lorem ipsum"}' http://127.0.0.1:3000/api/organizations 
    $ curl -H 'content-type: application/json' -v -X PUT -d '{"name":"Foo bar", "address": "street 1", "description": "lorem ipsum"}' http://127.0.0.1:3000/api/organizations/:id 
    $ curl -H 'content-type: application/json' -v -X DELETE http://127.0.0.1:3000/api/organizations/:id

Getting Pagination using limit and offset

    $ curl -H 'content-type: application/json' -v -X GET http://127.0.0.1:3000/api/customers?limit=10
    $ curl -H 'content-type: application/json' -v -X GET http://127.0.0.1:3000/api/customers?offset=10

nestjs-api-mongoose's People

Contributors

tony133 avatar dependabot[bot] 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.