# backjsdhkf

> const Koa = require('koa'); const app = new Koa(); const bodyParser = require('koa-bodyparser'); const cors = require('koa2-cors'); const query = require('./db/index'); const router = require('./router/index'); const session = require('koa-session-m

Latest version **1.0.0** (published 2022-07-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install backjsdhkf
pnpm add backjsdhkf
yarn add backjsdhkf
bun add backjsdhkf
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-07-26 |
| First published | 2022-07-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 13 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | liufangfang01 |

## Links

- npm: https://www.npmjs.com/package/backjsdhkf
- npm.io page: https://npm.io/package/backjsdhkf

## Dependencies (13)

- [koa](https://npm.io/package/koa.md) ^2.13.4
- [pm2](https://npm.io/package/pm2.md) ^5.2.0
- [mysql](https://npm.io/package/mysql.md) ^2.18.1
- [koa2-cors](https://npm.io/package/koa2-cors.md) ^2.0.6
- [koa-helmet](https://npm.io/package/koa-helmet.md) ^6.1.0
- [koa-router](https://npm.io/package/koa-router.md) ^12.0.0
- [koa-static](https://npm.io/package/koa-static.md) ^5.0.0
- [koa-session](https://npm.io/package/koa-session.md) ^6.2.0
- [koa-bodyparser](https://npm.io/package/koa-bodyparser.md) ^4.3.0
- [koa-jsonwebtoken](https://npm.io/package/koa-jsonwebtoken.md) ^1.3.1
- [koa-mysql-session](https://npm.io/package/koa-mysql-session.md) ^0.0.2
- [koa-combine-routers](https://npm.io/package/koa-combine-routers.md) ^4.0.2
- [koa-session-minimal](https://npm.io/package/koa-session-minimal.md) ^4.0.2

## Recent versions

- 1.0.0 (latest) — 2022-07-26

## README

const Koa = require('koa');
const app = new Koa();
const bodyParser = require('koa-bodyparser');
const cors = require('koa2-cors');
const query = require('./db/index');
const router = require('./router/index');
const session = require('koa-session-minimal');
const MysqlSession = require('koa-mysql-session');
const authRole=require('./middleware/auth')

// 配置存储session信息的mysql
let store = new MysqlSession({
    user: 'root',
    password: 'root',
    database: '2001C',
    host: 'localhost',
})

// 存放sessionId的cookie配置，根据情况自己设定
let cookie = {
    maxAge: 20 * 60 * 1000, // cookie有效时长(ms)
    expires: '', // cookie失效时间
    path: '', // 写cookie所在的路径
    domain: '', // 写cookie所在的域名
    httpOnly: true, // 是否只用于http请求中获取
    overwrite: true, // 是否允许重写
    secure: '',
    sameSite: '',
    signed: true,
}
app.use(session({
    key: 'SESSION_ID',
    store: store,
    cookie: cookie
}))

app
    .use(authRole())
    .use(cors())
    .use(bodyParser())
    .use(router())
    .listen(3000, () => {
        console.log('http://localhost:3000');
    });

---
_Source: https://npm.io/package/backjsdhkf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
