Skip to content

仿知乎网站后端Node.js项目API接口实现,fakezhihu项目对应的后段代码,参考:https://github.com/RexkentZheng/fakezhihu-server

Notifications You must be signed in to change notification settings

cwy007/fakezhihu-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fakezhihu-server

用于提供后端api接口

book

《Vue.js前端开发基础与项目实战》• 郑韩京/编著

book

对应的前端项目

fakezhihu

在本地环境运行

启动mysql,新建数据库fakezhihu,使用sql脚本新建项目所需的数据库表

git clone https://github.com/cwy007/fakezhihu-server.git
cd fakezhihu-server
npm install
npm run dev

启动项目时,会打印出已经实现的接口

 cwy@Mpro ⮀ ~/tmp/fakezhihu-server ⮀ ⭠ main ⮀ npm run start

> fakezhihu-server@0.1.0 start /Users/chanweiyan/tmp/fakezhihu-server
> node bin/www

process controller: answers.js...
register URL mapping: POST /answers
register URL mapping: DELETE /answers
register URL mapping: PUT /answers
register URL mapping: GET /answers/creator
process controller: articles.js...
register URL mapping: POST /articles
register URL mapping: DELETE /articles
register URL mapping: GET /articles
register URL mapping: GET /articles/list
register URL mapping: PUT /articles
register URL mapping: GET /articles/creator
process controller: comments.js...
register URL mapping: GET /comments
register URL mapping: POST /comments
register URL mapping: DELETE /comments
process controller: imgs.js...
register URL mapping: POST /imgs/upload
process controller: index.js...
register URL mapping: GET /create
register URL mapping: GET /
process controller: questions.js...
register URL mapping: POST /questions
register URL mapping: PUT /questions
register URL mapping: GET /questions
register URL mapping: GET /questions/creator
process controller: status.js...
register URL mapping: PUT /status
process controller: users.js...
register URL mapping: GET /users/list
register URL mapping: POST /users/create
register URL mapping: POST /users/login
register URL mapping: GET /users/checkLogin
register URL mapping: POST /users/logout
register URL mapping: GET /users
register URL mapping: PUT /users
==============================================================
 Fakezhihu-server
--------------------------------------------------------------
 Start prot : 3000
 Up time: Thu Dec 03 2020 17:46:03 GMT+0800 (China Standard Time)
==============================================================

targetType 字段

question 没有 status
// 文章0、问题1、答案2

statuses 
targetType: {
  0: 'article',
  1: 'question',
  2: 'answer',
  3: 'comment'
}

comments 
targetType 字段
// article:0, question:1, answer: 2, comment:3

参考

About

仿知乎网站后端Node.js项目API接口实现,fakezhihu项目对应的后段代码,参考:https://github.com/RexkentZheng/fakezhihu-server

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages