Node.js common file directory and module function

1. Directory structure

 

The use of the corresponding folder:

models: store files for operation database
public: store static files, such as styles, pictures, etc.
routes: store route files
views: store template files
index.js: program main file
package.json: store project name, description, author, dependencies, etc. information

 

2. Install dependent modules

 

The use of the corresponding module:
express: web framework
express-session: session middleware
connect-mongo: store session in mongodb, use express-session with
connect-flash: page notification prompt middleware, based on session to implement
ejs: template
express- formidable: receiving form and file upload middleware
config-lite: reading configuration file
marked: markdown parsing
moment: time formatting
mongolass: mongodb driver
objectid-to-timestamp: generating timestamp based on ObjectId
sha1: sha1 encryption, used for password Encrypt
winston: log
express-winston: winston-based log middleware for express

Published 36 original articles · won praise 2 · Views 3799

Guess you like

Origin blog.csdn.net/wangyongfei1122/article/details/84883944