search

Home  >  Q&A  >  body text

node.js - express hosting static directory problem

I see many abbreviations:

let app = require('express')();

Then I want to use app.use(express.static('public'));What should I do with this kind of thing?
Must be written separately:

let express = require('express');
let app = express();

Is it true that we can’t be lazy in this kind of situation?

迷茫迷茫2824 days ago533

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 13:40:56

    It should always be written like this, concise and clear

    let express = require('express');
    let app = express();

    reply
    0
  • Cancelreply