Questions about node.js Note

1. Use NodeJS write code that implements all Traverse Folder and file names

const fs = require('fs');
const path = require('path');

const readDir = (entry)=>{
    const dirInfo = fs.readdirSync(entry);
    dirInfo.forEach(item =>{
    const location = path.join (entry,item);
    const info = fs.statSync(location);
    if(info.isDirectory()){
        console.log(`dir:${location}`);
        readDir(location);
     }else{
        console.log(`file:${location})
      }
    }) 
} 

// This uses recursion thought, layer by layer depth search to determine 

readDir (__ dirname);

 

2. Modular difference, AMD, CMD, COMMENJS, ESMODULE

   AMD is characterized by a reliance front, commonjs require a syntax, ESmodule is a static introduced, the other two is a dynamic introduction;

 

3.node framework mvc

 Mvc mvc with the rear end of the preceding different, m means the rear end of the data layer, the view v refers to the layer, the control layer C means ,, said front end mvc v is a detailed view of the white layer in the rear end of the mvc, more preceding or mvvm model

5.mongo advantage with mysql

Mysql features and advantages and disadvantages:

Portability of source code;

Supported operating systems and more;

Provided API (the interface) into several languages

Support for multiple storage engines;

Disadvantages:

Inflexibility relational tables;

Storage Engine confusion;

The lack of native support json

mongodb features and advantages and disadvantages:

Structure more flexible and able to quickly acquire data, to ensure the user's access speed

Multiple Document storage structure

Built-in GridFS, support large capacity storage

Performance, multi-related third-party support

Disadvantages:

It does not support transactional operations, likely to cause mistake, not suitable for strong rules require data storage structure stability

A large amount of memory,

No associated table queries, the situation is not suitable for complex relationships

No sophisticated maintenance tool

 

Guess you like

Origin www.cnblogs.com/BR-Tao/p/11373033.html