小编Ric*_* WU的帖子

没有玉的Express Generator

我正在尝试使用快速生成器生成快速骨架.所以它会是这样的:

$ npm install express-generator -g
Run Code Online (Sandbox Code Playgroud)

但是,它添加了一堆自动玉文件.

我想知道是否有办法摆脱那些玉文件,只使用快速生成器的html

谢谢!

html node.js express pug

18
推荐指数
3
解决办法
1万
查看次数

ExpressJS错误:Body-Parser已弃用

问题 我正在尝试构建一个Node.js API,在编写我的server.js文件时,我的代码如下所示:

var express = require('express');
var express = require('body-parser');

var app = express();
app.use(bodyParser.json());

app.get('/api/posts', function(req,res) {
res.json([
    {
        username: 'oscar',
        body: 'hello'
    }

])
})

app.listen(3000, function() {
console.log('Server Listening on', 3000)
})
Run Code Online (Sandbox Code Playgroud)

但是,在命令提示符中,我收到此错误:

body-parser deprecated bodyParser: use individual json.urlencoded
middlewares server.js:4:11
body-parser deprecated undefined extended: provide extended option
node_modules\body-parser\index.js:85:29
Run Code Online (Sandbox Code Playgroud)

我尝试将其更改为:

app.use(bodyParser.urlencoded({ extended: true }));
Run Code Online (Sandbox Code Playgroud)

app.use(bodyParser.urlencoded({ extended: false }))
Run Code Online (Sandbox Code Playgroud)

像其他帖子建议,但它仍然给出相同的错误.不知道现在该做什么!请帮忙.

谢谢!

deprecated node.js express body-parser

10
推荐指数
3
解决办法
2万
查看次数

Git:SSL证书问题

我在我的cmd中运行git命令.它工作了一段时间,但现在每当我使用git命令时,会发生以下错误

fatal: unable to access 'github.com/user_name/repo_name.git/' 
:  SSL certificate problem: unable to get local issuer certificate
Run Code Online (Sandbox Code Playgroud)

它在一周前工作,但是当我没有改变任何东西时它就不再存在了.这很奇怪.我的操作系统是WIndows 8.1和Git 1.9.5版

谢谢!

git ssl github

5
推荐指数
1
解决办法
138
查看次数

标签 统计

express ×2

node.js ×2

body-parser ×1

deprecated ×1

git ×1

github ×1

html ×1

pug ×1

ssl ×1