Giter Site home page Giter Site logo

koa-demos's Issues

build image时提示有错误

运行环境:ARM VPS + ubuntu

运行 $ docker image build -t koa-demo . 之后,提出如下错误:
[Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

是否可以看下怎么解决,谢谢。

请问,实例9中报错找不到fs.promised模块,需要做啥呢?

代码

const Koa = require('koa');
const fs = require('fs.promised');
const app = new Koa();

const main = async function (ctx, next){

    ctx.response.type = 'html';
    ctx.response.body = await fs.readFile('./demos/template.html', 'utf8');

}

app.use(main);
app.listen(3000);

报错

Error: Cannot find module 'fs.promised'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (f:\github\myStudy\koa\demos\10.js:2:12)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)

请问最后一个文件上传问题?

curl是linux的命令,这里假如我模拟一个Post请求,请求本地的3000端口,,请求为files: 本地的文件的真是路径(例如C:\Users\xx\Desktop\koa-demos-master.zip),

const files = ctx.request.body.files || {} 就是直接拿到了 C:\Users\xx\Desktop\koa-demos-master.zip这个路径了,然后下面又是遍历,,结果下面 又对这个files遍历了

const filePath = path.join(tmpdir,file.name)
file.name肯定会是undefined,然后文件肯定是不能上传,我想问的就是在windows上这个例子该怎么写啊?如何更好然后模拟测试呢?不知道怎么写?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.