-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.js
46 lines (39 loc) · 2.05 KB
/
api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"use strict";
// const models = require('./db');
const express = require('express')
const Mongoose = require('mongoose')
const router = express.Router();
const path = require('path')
const fs = require('fs')
const promise = require('promise')
const articleControler = require('./controler/article.controler.js')
const articleListControler = require('./controler/articleList.controler.js')
const userControler = require('./controler/user.controler.js')
const systemControler = require('./controler/system.controler.js')
const commentControler = require('./controler/comment.controler.js')
// 全局操作
router.get('/api/addVisitedNum', systemControler.addVisitedNum)
router.get('/api/getVisitedNum', systemControler.getVisitedNum)
/************** 创建(create) 读取(get) 更新(update) 删除(delete) **************/
// 文章集操作
router.get('/api/getArticleList', articleListControler.getArticleList)
router.post('/api/addArticleList', articleListControler.addArticleList)
router.post('/api/removeArticleList', articleListControler.removeArticleList)
// 文章操作
router.get('/api/getPublishArticleNum', articleControler.getPublishArticleNum)
router.get('/api/getAllArticle', articleControler.getAllArticle)
router.post('/api/getArticleById', articleControler.getArticleById)
router.post('/api/getPublishArticleInOneListById', articleControler.getPublishArticleInOneListById)
router.post('/api/addOrModifyArticle', articleControler.addOrModifyArticle)
router.post('/api/removeArticle', articleControler.removeArticle)
// 评论操作
router.post('/api/getAllComments', commentControler.getAllComments)
router.post('/api/addComment', commentControler.addComment)
router.post('/api/addLikeToComment', commentControler.addLikeToComment)
router.post('/api/removeLikeFromComment', commentControler.removeLikeFromComment)
// router.post('/api/addDisToComment', commentControler.addDisToComment)
// 用户操作
router.post('/api/signUp', userControler.signUp)
router.post('/api/signIn', userControler.signIn)
router.post('/api/signOut', userControler.signOut)
module.exports = router;