会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 134098个问题

var express = require('express');
var app = express();
var data=require('./data')

app.get('/', (req, res) => {
    res.send('首页')

}
)

app.get('/news',(req,res)=>{
    var id=req.query.id;
    res.send({
        id:id,
        title:'新闻表示'+id,
        desc:'新闻介绍哈哈哈哈哈'+id,
        commentsUrl:'/comments?pingId='+id
    })
})
  app.get('/comments',(req,res)=>{
      var pingId=req.query.pingId;
      res.send(
          data.filter((item)=>{
              return item &&item.id==pingId
          })
      )

  })
app.listen(3000,()=>{
    console.log(3000);
})


module.exports = [
    {
        id: '1001',
        name: 'la1', content: 'lalalalal'
    }, {
        id: '1002',
        name: 'la2',
        content: 'enenenene'
    }, {
        id: '1003',
        name: 'la',
        content: 'yiyiiyi'
    }
]
function getNews(url) {
    let promise = new Promise((resolve, reject) => {
        $.ajax(
            {
                type: 'get', url: url,

                success: (res) => {
                    resolve(res);
                },
                error: (resolve) => {
                   reject(err)
                }
            }
        )
    })
    return promise;
}

getNews('http://localhost:3000/news?id=1001').then(
    (res) => {
        console.log(res);
        var url = res.commentsUrl;
        return getNews('http://localhost:3000' + url)
    }, (err) => {
        console.log(err);
    }
).then((data) => {
    console.log(data);
}, (err) => {
    console.log(err);
})


老师为什么我实现不了功能image.png

WEB前端全系列/第七阶段:ECMAScript6新特性模块/ES6第二部分 32671楼

flask_shop.zip

老师好,请问我这里一直提示异常错误,没找到原因。麻烦老师看看

image.png

Python全系列/第九阶段:Flask百战电商后台系统/Flask百战电商后台项目 32672楼
Python全系列/第六阶段:数据库与AI协同技术实战/mysql介绍与环境安装 32673楼
Python全系列/第一阶段:AI驱动的Python编程/编程基本概念 32674楼
Python全系列/第一阶段:AI驱动的Python编程/面向对象 32676楼
Python全系列/第一阶段:AI驱动的Python编程/编程基本概念 32677楼
Python全系列/第二阶段:Python 深入与提高/模块 32678楼
JAVA 全系列/第二十五阶段:容器管理技术/Docker 32680楼
JAVA 全系列/第九阶段:Spring Boot实战/Spring Boot 32682楼
Python全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 32683楼
JAVA 全系列/第十八阶段:亿级高并发电商项目_架构/编码(旧)/电商:基于FastDFS+Nginx+Kinkeditor实现商品新增 32684楼
JAVA 全系列/第九阶段:SpringBoot与MybatisPlus/Spring Boot旧 32685楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637