unstable typescript
This commit is contained in:
1 parent
274e1e7fc0
commit
b35e4e36e2
19 files changed
+658
-286
No files matched your search
@@ -1,15 +1,14 @@
|
||||
import { connect } from '../../../src/core/db'
|
||||
import { findArticles } from '../../../src/api/articles'
|
||||
// import { findArticles } from '../../../src/api/articles'
|
||||
import { withMiddleware } from '../../../src/middlewares/withMiddleware'
|
||||
import Article from '../../../src/core/Article'
|
||||
|
||||
export default withMiddleware(async (req, res) => {
|
||||
await connect()
|
||||
// const { query } = req
|
||||
// const page = parseInt(query.page)
|
||||
// const pageSize = parseInt(query.pageSize)
|
||||
|
||||
const { query } = req
|
||||
const page = parseInt(query.page)
|
||||
const pageSize = parseInt(query.pageSize)
|
||||
|
||||
const data = await findArticles(page, pageSize)
|
||||
// const data = await findArticles(page, pageSize)
|
||||
const data = await Article.find({})
|
||||
|
||||
if (data) {
|
||||
res.json(data)
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { connect } from '../../../src/core/db'
|
||||
import Page from '../../../src/core/Page'
|
||||
import { withMiddleware } from '../../../src/middlewares/withMiddleware'
|
||||
|
||||
export default withMiddleware(async (req, res) => {
|
||||
await connect()
|
||||
|
||||
const items = await Page.find({})
|
||||
|
||||
if (items) {
|
||||
|
||||
Reference in new issue
Block a user