Giter Site home page Giter Site logo

nodejsexpress_test's Introduction

#NODEJS EXPRESS MONGODB

Description

The project aim's to develop un API with node JS, Express and mongodb, the Api will manage the system of trade commercial, with the selling product and a system of cart where where the user can add and remove product on the cart.

####We have two Collection Mongo Db

######Product

schema:

                    {
                      "name": String,
                      "price": Number,
                      "category": String,
                      "description": String,
                      "quantity": Number
                      }

link with collection we fund routes:

get all products
{ route: { path: 'products/', method: 'get' } },


> > GET a product by id
{ route: { path: 'product/:id', method: 'get' } },
{ params: {"id": String} > > CREATE a product
{ route: { path: '/product', method: 'post' } },
{ params: {"name": String, "price": Number, "category": String, "description": String, "quantity": Number} > > UPDATE a product by id
{ route: { path: '/product:id', method: 'patch' } },
{ params: {"name?": String, "price?": Number, "category?": String, "description?": String, "quantity?": Number} > > DELETE a product by id
{ route: { path: '/product:id', method: 'delete' } },
{ params: {"id": String}
______________________________________

######Command

schema:

                    {
                      "date": Date,
                      "createdAt": Date,
                      "updatedAt": Date,
                      "articles": [],
                      "min_price": Number,
                      "isCompleted": Boolean,
                      }

link with collection we fund routes:

FIND a command by date
{ route: { path: 'command/find/date/:date', method: 'get' } }, { params: {"date": String }


> > FIND a command by date and price
{ route: { path: 'command/find/:date&:price', method: 'get' } }, { params: {"date": String, "price": String }
> > FIND a command by sort by or(date, articles, price)
{ route: { path: 'product/sort*?', method: 'get' } },
{ params: {date: String, articles: String, price} > > UPDATE a command by id
{ route: { path: 'command/:id', method: 'patch' } },
{ params: {"date?": Date, "articles?": [], "min_price?": number, "isCompleted": boolean} > > UPDATE add a product in the command by id
{ route: { path: '/command/add/:id&:productId', method: 'patch' } },
{ params: {"id": String} > > UPDATE delete a product in the command by id
{ route: { path: '/command/add/:id&:productId', method: 'patch' } },
{ params: {"id": String, "productId": String} > > UPDATE delete a product in the command by id
{ route: { path: '/command/buy/:id', method: 'patch' } },
{ params: {"id": String}

Installation

$ npm install

###Add collection

  1. Folder ${collection_name}
    1. create file ${collection_name}.controller.ts / ${collection_name}.interface.ts / ${collection_name}.service.ts / ${collection_name}.service.ts
  2. Create folder Schema/dto/model
    1. inside model create file ${collection_name}.model.ts / ${collection_name}.schema.ts
  3. add your ${controller_name} build/server.ts

Running the app

create file "config.env" inside of config folder and add this missing information :
PORT =
MONGO_URI =
JWT_SECRET =

# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod

On Docker

$ docker-compose up

Stay in touch

nodejsexpress_test's People

Contributors

mp-anselin avatar

Watchers

 avatar  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.