nodejs express服务器搭建和使用教程
来源:互联网 发布:win10笔记本电脑优化 编辑:程序博客网 时间:2024/05/16 13:55
腾讯开发者实验室 express入门指导
如果想了解更多express搭建服务器的信息,请访问express官网
app.js
var express = require('express');var app = express();// 对网站首页的访问返回 "Hello World!" 字样app.get('/', function (req, res) { res.send('Hello World!');});// 网站首页接受 POST 请求app.post('/', function (req, res) { res.send('Got a POST request');});// /user 节点接受 PUT 请求app.put('/user', function (req, res) { res.send('Got a PUT request at /user');});// /user 节点接受 DELETE 请求app.delete('/user', function (req, res) { res.send('Got a DELETE request at /user');});var server = app.listen(3000, function () { console.log('Example app listening on port 3000!');});
app.js
var express = require('express');var app = express();app.use(express.static('public'));var server = app.listen(3000, function () { console.log('Example app listening on port 3000!');});
hello.html
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title></head><body> <h1>Hello World</h1></body></html>
app.js
var express = require('express');var app = express();app.use('/static', express.static('public'));var server = app.listen(3000, function () { console.log('Example app listening on port 3000!');});
阅读全文
0 0
- nodejs express服务器搭建和使用教程
- 使用express搭建nodejs项目
- Nodejs的express使用教程
- 使用nodejs、Express和MongDB搭建个人博客
- nodeJS express框架搭建web服务器
- Nodejs搭建服务器express框架理解
- 搭建一个nodejs项目 使用express
- nodejs 使用express 搭建简单前端demo
- 使用Express搭建Web服务器
- 使用express+mockjs搭建服务器和模拟数据
- nodejs-express环境搭建
- Nodejs,express博客搭建
- nodejs创建服务器和利用express创建服务器
- SVN服务器搭建和使用教程
- SVN服务器搭建和使用教程
- NodeJS 使用express、mongolian搭建轻量级web应用
- 使用Express搭建HTTPs加密服务器
- nodejs express 框架使用
- 对象的notify()和notifyAll()区别
- 数据结构(四)排序算法(一)冒泡,插入,希尔排序
- Tess4J OCR简单使用教程
- 在windows10上安装ubuntu并搭建java运行环境
- 代理设计模式之静态代理与动态代理(超..)详解
- nodejs express服务器搭建和使用教程
- 【es6】symbol
- 七牛云存储的 Javascript Web 前端文件上传
- 模拟题 动态规划
- POJ1915BFS
- shell内置测试判断
- Mysql innodb 间隙锁: 记录不存在也会加间隙锁
- [2602]Bone Collector(0-1背包问题)
- shell内置测试判断