Giter VIP home page Giter VIP logo

ecommerce-proj's Introduction

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

Installation

$ yarn install

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

Test

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

ecommerce-proj's People

Watchers

Phạm Quốc Vỹ avatar

ecommerce-proj's Issues

[BE004]: Cluster vs Worker thread

CLUSTER

- Định nghĩa: Cluster được dùng để tạo ra nhiều tiến trình con để giảm tải cho tiến trình chính, các tiến trình con này sẽ hoạt động độc lập và xử lý các tác vụ riêng biệt (số child process được tạo ra dựa vào số lõi CPU mà thiết bị có)
- Tác dụng: Có ích cho các tác vụ I/O bound (các tác vụ cần thời gian xử lý như Connect DB, file, internet,...), xử lý được nhiều request hơn, nếu có tác vụ nào đó tính toán nặng thì các request đến từ các client khác vẫn hoạt động bình thường

[BEK002]: Access Token vs Refresh Token

Khi login thì Server sẽ trả về Access token và Refresh Token để những lần request sau client sẽ gửi kèm token vào header để request mà không cần phải login lại

Access Token:

  • Access Token có expire time ngắn hơn so với Refresh Token thường là vài giờ hoặc 1 ngày, được sử dụng để gửi kèm header khi cần request lên Server
  • Nếu Access token hết hạn thì sẽ sử dụng đến refresh token để lấy access token mới

Refresh Token:

  • Refresh token có expire time dài hơn so với Access token, thường là từ vài ngày đến vài tuần, được sử dụng để get access token mới khi access token hết hạn
  • Nếu Refresh token hết hạn thì sẽ logout người dùng và bắt người dùng login lại

Algorithm Array

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.

Example 1:

Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].
Example 2:

Input: nums = [3,2,4], target = 6
Output: [1,2]
Example 3:

Input: nums = [3,3], target = 6
Output: [0,1]

Constraints:

2 <= nums.length <= 104
-109 <= nums[i] <= 109
-109 <= target <= 109
Only one valid answer exists.

Image

[BEL003]: SOLID

SOLID là tập hơn các nguyên tắc thiết kế phần mềm trong lập trình hướng đối tượng, nếu áp dụng được các nguyên tắc này trong quá trình code thì code sẽ Cleon và xịn và chuyên nghiệp hơn, sẽ giúp cho code dễ maintain và mở rộng hơn

S (Single Reponsibility Principles): mỗi class chỉ nên có 1 trách nhiệm duy nhất

O (Open - closed principles): khi thêm một function hay chức năng gì đó thì nên kế thừa từ class cần thiết tránh việc thay đổi trục tiếp trên đó sẽ gây ra lỗi ở nhiều nơi mà không kiểm soát được

L (Liskov subtitution principles): Nguyên lý thay thế Liskov, các lớp con có thể thay thế lớp cha, nếu lớp con không thể thay thế lớp cha hoàn toàn thì nó không phải là lớp con đúng đắn của lớp cha
Ví dụ: Có chương trình Bán Vịt thì sẽ có class cha là Duck và từ class cha này có thể tạo ra các class con như Vịt xiêm, Vịt trắng, Vịt Mỹ,.. Thì những class con này có thể thay thế class cha, nhưng có class như Vịt đồ chơi thì sẽ không thể thay thế được lớp cha vì nó làm thay đổi tính đúng đắn của chương trình

I (Interface segeration principles): nghĩa là sẽ tách các interface thành các thành phần nhỏ hơn, tránh việc các class implement từ interface quá lớn sẽ gây dư thừa và khó sử dụng quản lý hơn
Ví dụ: thay vì có 1 interface về hành động của con vật trong interface đó có thể chứa các hành động như: bay, nhảy, bơi, ăn,… hay hàng trăm hành động khác. Thì nếu implement từ interface này sẽ gây dư thùa và khó quản lý

D (Dependency inversion principle): các module cấp cao không nên phụ thuộc vào các module cấp thấp, mà cả 2 nên phụ thuộc vào các abtraction (interface hoặc abstract classes). Các abtraction không nên phụ thuộc vào chi tiết và các chi tiết thì nên phụ thuộc abtraction

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.