koa2


------------koa-----------------
// automatically restarts
npm install nodemon --save-dev   

npm install --save koa-router@7
const Router = require('koa-router')

npm install --save koa-bodyparser@3
const bodyParser = require('koa-bodyparser')


npm install koa-static
const static = require('koa-static')
app.use(static(
  path.join( __dirname,  staticPath)
))

//
npm install koa-session-minimal
const session = require('koa-session-minimal')

//
npm install koa-mysql-session
const MysqlSession = require('koa-mysql-session')


# 安装koa模板使用中间件
npm install --save koa-views

# 安装ejs模板引擎
npm install --save ejs


node xx.js
------------koa-----------------

 npm install koa koa-router koa-bodyparser typeorm pg class-validator ts-node tsconfig-paths --save

Non-Dev Dependencies
koa: This is the framework that we are going to be using. Check my note below for more information on KOA and why we are using it.
koa-router: Needed for creating and managing routes. Basically, we use this to tell the server how to handle client requests to different URL’s (my-website.com/users vs my-website.com/products)
koa-bodyparser: Needed to parse the body of any requests that are sent to our API by a client. For example when a client passes their User Id to us we need this parser to extract their User Id from the request.
typeorm: This is an ‘Object Relational Mapping’ or ORM package. It allows us to create a model of relational data stored in our database and represent this as an object that we can use in our Javascript code.
pg: This is a database driver that is needed to connect to PostgreSQL.
class-validator: This package has functionality that we can use to validate objects and data such as checking if an email address is valid.
ts-node: Needed so we can run our Typescript code via Node.
tsconfig-paths: Allows us to map our paths to a base URL which makes things cleaner when referencing file paths in the code.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值