1-1 在本地构建代码

  1. yarn init -y
  2. yarn add koa koa-router
const koa = require("koa");
const app =  new koa();
const router = require("koa-router")();
router.get("/",async ctx=>{
    ctx.body="hello world"
})
app.use(router.routes());
app.listen(8080)

1-2 上传项目

01.png

1-3 启动项目

cd /home/hello  #  读取对于文件夹
yarn #  安装依赖
cnpm i nodemon -g
nodemon index.js

1-4 打开8080端口

02.png

image.png
04.png