博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
express静态服务_使用Express服务静态资产
阅读量:2502 次
发布时间:2019-05-11

本文共 510 字,大约阅读时间需要 1 分钟。

express静态服务

It’s common to have images, CSS and more in a public subfolder, and expose them to the root level:

通常在public子文件夹中包含图像,CSS等,然后将其公开到根目录:

const express = require('express')const app = express()app.use(express.static('public'))/* ... */app.listen(3000, () => console.log('Server ready'))

If you have an index.html file in public/, that will be served if you now hit the root domain URL (http://localhost:3000)

如果您在public/有一个index.html文件,那么如果您现在访问根域URL( http://localhost:3000 ),该文件将被提供。

翻译自:

express静态服务

转载地址:http://qaqgb.baihongyu.com/

你可能感兴趣的文章
python flask 如何修改默认端口号
查看>>
Map<String,Object> map=new HashMap<String,Object>详解
查看>>
实现tap的多种方式
查看>>
UVA - 10494 If We Were a Child Again
查看>>
html5 canvas 渲染像素混合模式
查看>>
【hexo】01安装
查看>>
CI框架源码学习笔记2——Common.php
查看>>
005---书籍添加和编辑的提交数据
查看>>
使用case语句给字体改变颜色
查看>>
JAVA基础-多线程
查看>>
面试题5:字符串替换空格
查看>>
JSP九大内置对象及四个作用域
查看>>
OCAC公告
查看>>
Modernizr.js介绍与使用
查看>>
ConnectionString 属性尚未初始化
查看>>
解决Spring MVC无法接收AJAX使用PUT与DELETE请求传输的内容
查看>>
数据结构-栈 C和C++的实现
查看>>
发布功能完成
查看>>
C#获取客服端ip和用户名
查看>>
Asp.net MVC 之ActionResult
查看>>