首页 > 技术文章 > koa基础项目搭建

lvlv11 2022-01-13 11:30 原文

1.创建package.json文件
npm init //执行命令

package name: (koa) koa //项目名称
version: (1.0.0) // 版本
description: koa // 描述
entry point: (index.js) index.ts // 入口文件
test command: jest // 单元测试
git repository:
keywords: koa,ts,mysql
author: lv
license: (ISC) MIT // 协议

cnpm i //安装依赖
cnpm i koa @types/koa -D //安装koa到开发环境
cnpm i koa-router @types/koa-router -D //安装koa-router到开发环境
2.整理目录机构

image

cnpm i ts-node typescript -D //安装ts到开发环境
添加启动文件

image

推荐阅读