nodejs + koa-generator 创建后端项目

E:\backend-workspace>npm install koa-generator -g

npm warn deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)

added 5 packages in 2s

E:\backend-workspace>koa2 emall-backend2 -e --ejs

create : emall-backend2

create : emall-backend2/package.json

create : emall-backend2/app.js

create : emall-backend2/public

create : emall-backend2/routes

create : emall-backend2/routes/index.js

create : emall-backend2/routes/users.js

create : emall-backend2/views

create : emall-backend2/views/index.ejs

create : emall-backend2/views/error.ejs

create : emall-backend2/bin

create : emall-backend2/bin/www

create : emall-backend2/public/stylesheets

create : emall-backend2/public/stylesheets/style.css

install dependencies:

> cd emall-backend2 && npm install

run the app:

> SET DEBUG=koa* & npm start emall-backend2

create : emall-backend2/public/javascripts

create : emall-backend2/public/images

E:\backend-workspace>cd emall-backend2 && npm install

npm warn deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated

npm warn deprecated consolidate@0.15.1: Please upgrade to consolidate v1.0.0+ as it has been modernized with several long-awaited fixes implemented. Maintenance is supported by Forward Email at https://forwardemail.net ; follow/watch https://github.com/ladjs/consolidate for updates and release changelog

npm warn deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated

npm warn deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated

npm warn deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

npm warn deprecated keygrip@1.1.0: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

npm warn deprecated koa-router@7.4.0: Please use @koa/router instead, starting from v9!

npm warn deprecated koa-views@6.3.1: This package is deprecated, please use the new fork @ladjs/koa-views. Maintenance is supported by Forward Email at https://forwardemail.net ; follow/watch https://github.com/ladjs/koa-views for updates and release changelog

npm warn deprecated ejs@2.3.4: Critical security bugs fixed in 2.5.5

added 389 packages in 9s

34 packages are looking for funding

run `npm fund` for details

E:\backend-workspace\emall-backend2> SET DEBUG=koa* & npm start emall-backend2

> emall-backend2@0.1.0 start

> node bin/www emall-backend2

koa-router defined route 'HEAD', 'GET' / +0ms

koa-router defined route 'HEAD', 'GET' /string +1ms

koa-router defined route 'HEAD', 'GET' /json +1ms

koa-router defined route 'HEAD', 'GET' /users/ +1ms

koa-router defined route 'HEAD', 'GET' /users/bar +0ms

koa:application use bodyParser +0ms

koa:application use filter +1ms

koa:application use logger +0ms

koa-static static "E:\backend-workspace\emall-backend2/public" {} +0ms

koa:application use serve +7ms

koa:application use views +0ms

koa:application use - +0ms

koa:application use dispatch +0ms

koa:application use dispatch +1ms

Port 3000 is already in use

E:\backend-workspace\emall-backend2> SET DEBUG=koa* & npm start emall-backend2

> emall-backend2@0.1.0 start

> node bin/www emall-backend2

koa-router defined route 'HEAD', 'GET' / +0ms

koa-router defined route 'HEAD', 'GET' /string +1ms

koa-router defined route 'HEAD', 'GET' /json +0ms

koa-router defined route 'HEAD', 'GET' /users/ +1ms

koa-router defined route 'HEAD', 'GET' /users/bar +1ms

koa:application use bodyParser +0ms

koa:application use filter +0ms

koa:application use logger +0ms

koa-static static "E:\backend-workspace\emall-backend2/public" {} +0ms

koa:application use serve +7ms

koa:application use views +0ms

koa:application use - +1ms

koa:application use dispatch +0ms

koa:application use dispatch +0ms

<-- GET /

koa-send send "/" {"root":"E:\\backend-workspace\\emall-backend2\\public","index":"index.html"} +0ms

koa-router GET / +0ms

koa-router test / /^(?:\/(?=))?/i { keys: \[\] } +1ms

koa-router test /string /^\/string(?:\/(?=))?/i { keys: \[\] } +0ms

koa-router test /json /^\/json(?:\/(?=))?/i { keys: \[\] } +0ms

koa-views render `index.ejs` with {"title":"Hello Koa 2!","partials":{}} +0ms

GET / - 13ms

--> GET / 200 27ms 226b

<-- GET /stylesheets/style.css

koa-send send "/stylesheets/style.css" {"root":"E:\\backend-workspace\\emall-backend2\\public","index":"index.html"} +65ms

--> GET /stylesheets/style.css 200 9ms 111b

<-- GET /favicon.ico

koa-send send "/favicon.ico" {"root":"E:\\backend-workspace\\emall-backend2\\public","index":"index.html"} +62ms

koa-router GET /favicon.ico +123ms

koa-router test / /^(?:\/(?=))?/i { keys: \[\] } +0ms

koa-router test /string /^\/string(?:\/(?=))?/i { keys: \[\] } +0ms

koa-router test /json /^\/json(?:\/(?=))?/i { keys: \[\] } +1ms

koa-router GET /favicon.ico +0ms

koa-router test /users/ /^\/users(?:\/(?=))?/i { keys: \[\] } +0ms

koa-router test /users/bar /^\/users\/bar(?:\/(?=))?/i { keys: \[\] } +0ms

GET /favicon.ico - 1ms

--> GET /favicon.ico 404 3ms -

相关推荐
先吃饱再说16 小时前
从“地狱”到“楼梯”再到“同步写法”:Node.js 异步的二十年与Node内置fs模块详解
node.js
知识收割者16 小时前
Nodejs也能写Agent - 10.LangChain篇 - 初识LangChain
node.js
HjhIron17 小时前
Node.js 内置模块之 path 与 fs:从路径拼接到异步演进
node.js·promise
触底反弹18 小时前
🚀 Node.js path 和 fs 模块,从回调地狱到 async/await 的进化之路!
javascript·后端·node.js
sugar__salt18 小时前
Node.js path 与 fs 核心模块完全指南 —— 从路径处理到异步流程控制
javascript·node.js
屑曦晨19 小时前
npm 全局包迁移指南:从系统目录到用户目录
npm·node.js
moMo20 小时前
Node.js 文件操作:path 路径与 fs 异步流程
node.js
拾年27520 小时前
Node.js 异步进化论:从 path 路径拼接到 fs 文件读取,我终于理解了回调地狱的救赎之路
前端·node.js
小粉粉hhh21 小时前
Node.js(五)——编写接口
前端·javascript·node.js
先吃饱再说1 天前
别再手动拼接路径了!Node.js path 模块的 9 个核心 API 详解
node.js