Skip to content

Instantly share code, notes, and snippets.

View winnchen's full-sized avatar

echoooooo winnchen

View GitHub Profile
@winnchen
winnchen / vscode
Created March 4, 2020 09:13
vscode
k
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@winnchen
winnchen / a.md
Last active November 5, 2015 09:54

#服务器运行步骤

  1. 运行mongodb数据库
cd C:\Program Files\MongoDB\Server\3.0\bin
mongod --dbpath F:\qdci_db
  1. 启动服务器
cd F:\qdci

Nodejs搭配Express4.x,获取请求参数主要有以下三种方式:

  1. req.query
  2. req.body
  3. req.params

这三种方式各有应用的场景,以下会结合代码介绍下~

req.query 用于获取GET请求中的参数

#####如何使用nodejs和Express框架处理http请求?

参考app.js和routes/index.js的处理过程。

app.js

var routes = require('./routes/index');
...
app.use('/', routes);