nodejs实现静态托管

const express = require("express");

const app = express();

/*
  1. 语法1: app.use(express.static('public'));

    • app.use()方法,是专门用来注册 中间件;

    • express.static 是express的内置中间件;

  2. 语法2:app.use('/虚拟目录', express.static('public'))


*/
//express.static(要托管的文件夹) app.use("/xxx", express.static("../https/")); app.listen(3000, () => { console.log("运行成功"); });

 

转载于:https://www.cnblogs.com/zbx-boke/p/9403541.html

你可能感兴趣的:(nodejs实现静态托管)