1 Star 0 Fork 0

wei/赚金币项目后台api

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
wei 提交于 2021-09-28 01:52 . 新增给主平台分类及视频获取api
// 引入模块
const Koa = require('koa')
const Router = require('koa-router')
const sendFile = require('koa-sendfile')
const path = require('path')
// const FUNCTION_NAME = 'selectAds'
// 实例化模块
const app = new Koa()
const router = new Router()
const ENV = 'main-9g11cspaf548a298'
// 跨域
// const cors = require('koa2-cors')
// app.use(cors({
// originP:['url'],
// credentials:true
// }))
// 全局中间件
app.use(async (ctx,next)=>{
ctx.state.env = ENV
await next()
})
// 引入获取动态列表模块
const newsList = require('./controller/newsList.js')
// 定义./newsList路由名称,使用newsList.routes()方法
// apigw.tencentcs.com/newslist/list
router.use('/newsList',newsList.routes())
// 声明允许路由方法使用
app.use(router.allowedMethods()).use(router.routes())
// Web 类型云函数,只能监听 9000 端口
app.listen(9000, () => {
console.log(`Server start on http://localhost:9000`);
});
app.on('error', (err, ctx) => {
console.log('server error', err, ctx);
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wei13013451000/zhuanjinbi-backend.git
[email protected]:wei13013451000/zhuanjinbi-backend.git
wei13013451000
zhuanjinbi-backend
赚金币项目后台api
master

搜索帮助