nodejs-日常练习记录-使用express搭建static服务器.
cd C:\wxg\test\node_demo\myapp
nvmw use 0.12.1
node static.js

var express = require('express');
var app = express();
var subApp = express();
subApp.get('/', function(req, res, next){
res.send('Hello, Welcome!');
console.log(111);
next();
});
app.use(subApp);
app.use('/easyui',express.static('./web/public/easyui/static'));
app.use('/easyui_lib',express.static('./web/libs/jquery-easyui'));
app.listen(3000, function(req, res){
console.log('http://localhost:3000');
console.log('app is running at port 3000');
});
访问 http://localhost:3000/easyui/hello.html 能够看到使用easyui制作的helloworld界面

nodejs-日常练习记录-使用express搭建static服务器.的更多相关文章
- 【nodejs之我的开源module】 使用express搭建web服务器,代码即文档的实现。
前言 都说nodejs适合制作restful_API,因为它有异步处理能力,能吞吐更多的请求,这一点是大家都认可的.前不久我使用nodejs+express+postgresql搭建了一个restfu ...
- express搭建web服务器、路由、get、post请求、multer上传文件、EJS模板引擎的使用
express官网 postman工具下载地址 multer的npm文档地址 express模板引擎怎么使用 地址:http://www.expressjs.com.cn/guide/using- ...
- express搭建服务器
学习express搭建node服务器 一.安装express框架 1.了解框架(百度) 2.下载框架 (1)使用npm命令下载 npm install express -g //全局安装,安装的是ex ...
- nginx 搭建图片服务器(windows 下,linux 下原理应该一样)
作者的心声:很多知道的.用过的东西,不写下来,下次还要百度查询,浪费时间和精力,故本次写下学习笔记,方便下次查阅. 题外话:如有读者通过我这篇博客解决了工作上的难题,可以给个评论,让我一起分享你的喜悦 ...
- NodeJS学习笔记(一)——搭建开发框架Express,实现Web网站登录验证
JS是脚本语言,脚本语言都需要一个解析器才能运行.对于写在HTML页面里的JS,浏览器充当了解析器的角色.而对于需要独立运行的JS,NodeJS就是一个解析器.每一种解析器都是一个运行环境,不但允许J ...
- 用Nodejs+Express搭建web,nodejs路由和Ajax传数据并返回状态,nodejs+mysql通过ajax获取数据并写入数据库
小编自学Nodejs,看了好多文章发现都不全,而且好多都是一模一样的 当然了,这只是基础的demo,经供参考,但是相信也会有收获 今天的内容是用Nodejs+Express搭建基本的web,然后呢no ...
- [NodeJs] 用Nodejs+Express搭建web,nodejs路由和Ajax传数据并返回状态,nodejs+mysql通过ajax获取数据并写入数据库
小编自学Nodejs,看了好多文章发现都不全,而且好多都是一模一样的 当然了,这只是基础的demo,经供参考,但是相信也会有收获 今天的内容是用Nodejs+Express搭建基本的web,然后呢no ...
- 使用nodejs和express搭建http web服务
目录 简介 使用nodejs搭建HTTP web服务 请求nodejs服务 第三方lib请求post 获取http请求的正文 Express和使用express搭建http web服务 express ...
- nodejs express搭建一个网站整理
先前用安卓完成了一个优惠券搜索的app,发现在app上操作比较麻烦,于是决定弄个网页版的.做网站是自己的擅长的,毕竟毕业之后咱一直用asp.net mvc做网站也好几个年头了. 可是这次我又想换个方式 ...
随机推荐
- Android 画直线并实现拖动
自定义View,在onDraw()方法中绘制一条直线,在onTouch()方法中监听手指的移动. public class AroundDragView extends View implements ...
- HW3.8
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- POJ2478 - Farey Sequence(法雷级数&&欧拉函数)
题目大意 直接看原文吧.... The Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rat ...
- hdoj 5522 Numbers
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5522 水题:暴力过 #include<stdio.h> #include<strin ...
- excel多个文件合并
多个excel文件合并成一个需要用ms office wps是不行的 1.将所有文件放在一个文件夹里 2.在文件夹里新建一个空的excel打开 右键sheet点击查看代码->输入下面代码-> ...
- SPOJ 3273 - Order statistic set , Treap
点击打开链接 题意: 集合S支持一下四种操作: INSERT(S,x) : 假设S中没有x,则插入x DELETE(S,x): 假设S中有x,则删除x K-TH(S): ...
- 多平台响应键盘事件!(适用于Cocos2dx 3.0 alpha以上版本号)
Hello everyone! For a week I've been looking on how to make a keyboard work! I managed to figure it ...
- android 无线模式下使用ADB调试
改动系统system权限 1. cp sud /system/xbin/sud chmod 755 /system/xbin/sud // note: su chmod 成755 2. cp su / ...
- hdu4462 Scaring the Birds
Scaring the Birds Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others ...
- 读写应用程序数据-NSUserDefault、对象归档(NSKeyedArchiver)、文件操作
ios中数据持久化存储方式一般有5种:NSUserDefault.对象归档(NSKeyedArchiver).文件操作.数据库存储(SQLite3).CoreData. 1.NSUserDefault ...