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("运行成功"); });

 

posted @ 2018-08-01 19:42  会说话的mao  阅读(268)  评论(0编辑  收藏  举报