chen-gary / note-squared Goto Github PK
View Code? Open in Web Editor NEWA web-based note-taking application
License: MIT License
A web-based note-taking application
License: MIT License
This document explains the note apis
All the operations here need user authentication
mode: new
, note fields
(you can refer to the testing documentation)mode: edit
, noteId
, the new field values
(if no need to change, pass empty string or null)mode: new
, title
mode: edit
, folderId
, title
noteId
, oldFolderId
, newFolderId
mode: like / dislike
, noteId
noteId
(note to be forked), folderId
(where the new note will be saved)noteId
Node.js
Server will run in port 3000 (i.e. localhost:3000
)
MongoDB
完全使用默认配置
note_squared
的数据库,可使用MongoDB Compass查看cd /note-squared/server
# 安装依赖
npm install
# 使用 nodemon 运行 server(如果修改 server 代码,会自动 restart)
npm run dev
# OR 使用以下命令(如果修改 server 代码,不会自动 restart)
npm run start
如何获得一个带有 admin 权限的账号?
现在无法直接注册带有 admin 权限的账号了,需要手动修改数据库: users => role,手动改为admin
/ normal
注册时,需要验证邮箱吗?
目前调用获取邮箱验证码的API后,验证码会直接返回给前端,所以即使填了假邮箱也没事。
如果需要测试邮件是否真的能发送,找到server/app/router/user/register_emailVerificationCode.js
文件中以下代码:
// send verification email
// (temporarily removed)
//await nodemailer.sendVerificationCode(_email, _email, _verificationCode)
删掉最后一行的注释即可。
get folders and notes:
[
{
"folder_id":"6257bde2ae6b2d0f2d28250c",
"folder_title": "folder 1",
"folder_name": "1", // created by frontend automatically, should be posted to backend when creating a new folder
"note": [
{
"note_id": "12345",
"note_title": "article title",
"note_description": "balabala",
"mode": "public/privacy"
// other infomation: liked num, comments num, ... (optional)
},
{
"note_id": "123456",
"note_title": "article title",
"note_description": "balabala",
"mode": "public/privacy"
}
]
},
{
"folder_id":"6257bde2ae6b2d0f2d28250d",
"folder_title": "folder 2",
"folder_name": "2",
"note":[]
}
]
get folders
[
{
"folder_id":"6257bde2ae6b2d0f2d28250c",
"folder_title": "folder 1",
"folder_name": "1", // created by frontend automatically, should be posted to backend when creating a new folder
},
{
"folder_id":"6257bde2ae6b2d0f2d28250d",
"folder_title": "folder 2",
"folder_name": "2",
}
]
implmentation suggestion
change the "/note/local-folder-notes-get" method to be post
according to different params:
{ withNote: true/false }
return different data
鉴于后端测试的时候照着脚本一个一个填写req.body的元素有些麻烦,这里列出填写内容参考:
需要填写body的post:
email: [email protected]
password: 123
name: tim
email: [email protected]
password: 123
name: tim
verification code: mGXy
id: 6252f5d83c277bd5d3b97d0e
email: [email protected]
password: 123
picture: local path
mode: edit / new
folderId: 9089089-98
title: hyy_blog
description: this is a test
contentMD: holle word!!!!!
visibility: public / private
noteId: 794y59237534589
title: hyy_directory
folderId: 7889880909898
noteId: the id of the note to be deleted
folderId: the folder that the note is attached to
folderId: the folder to be deleted
noteId: the id of the note to be deleted
oldFolderId: the folder to move out the note
newFolderId: the folder to move in the note
mode: like / dislike
noteId: the note to be liked or disliked
noteId: the note to fork
folderId: the folder to save the forked note
params: noteId
no input
Part 1: 普通用户操作
Part 2: 普通用户笔记相关操作
创建一个新的笔记
查看新上传的笔记
笔记管理操作:文件夹
创建多个文件夹a1,a2
在某一个文件夹a1下创建多个文件b1,b2,b3
将b3文件移动至a2
删除文件b2
删除文件夹a1
Note community:
Part 3: Admin用户操作
注册 / 登录
上传/获取 头像
改名
改密码*2(with old password / with email)
改邮箱?
检查Email syntax
检查password复杂度
昵称最短长度?
编辑/新增/删除 笔记
加folder(分类)
数据库查询笔记 - 结果需要分页
查询结果给所有normal user(仅限public note)
笔记推荐功能(sort by time, sort by 点赞数, 其他算法?)
搜索功能 - 搜索所有public notes(正则匹配?)
查询结果给自己(public + private)
查询结果给admin?(public + private)
fork 他人分享的笔记
点赞?
评论
Change server listening port if needed.
In app/index.js
, update the following code:
const PORT = 3000
Remove console log info if needed.
In app/index.js
, update the following code:
// print request info from front-end to console
// (comment this out if you do not want to see the log)
app.use(morgan('dev'))
Update database config if needed.
Go to app/config/db.js
, update the config.
Update secret key for jwt signing if needed.
Go to app/config/key.js
, update secret_jwt
.
Update email and password for sending verification code.
Go to app/config/nodemailer.config.js
, update the following.
// config of email sender
const user = "[email protected]"
const pass = "xxxxxxxxxxxxxxx"
[IMPORTANT] Make the server really send the verification code emails.
Go to app/router/user/register-email-verification-code.js
, uncomment the following:
// send verification email
// (temporarily removed)
//await nodemailer.sendVerificationCode_register(_email, _email, _verificationCode)
Go to app/router/user/set-pwd-email-verification-code.js
, uncomment the following:
// send verification email
// (temporarily removed)
// await nodemailer.sendVerificationCode_resetPwd(user.name, _email, _verificationCode)
Tutorial: https://www.youtube.com/watch?v=-oTdaFDvLo4
apt update
#apt install nginx
#service nginx status
apt install mongodb
service mongodb status
apt install npm
npm -v
node -v
# install `n` to manage node version
npm i -g n
n 12
#exit and login to server again
node -v
npm -v
git clone ...
# install dependencies
#npm i -g yarn
#yarn
npm install
#set nginx to deliver static files...
npm i -g pm2
pm2 start ...
#pm2 start app
#pm2 restart app
pm2 status
#set nginx again...
#set server to only listen to localhost...
描述: Web端笔记软件
必须功能(具体见Project Specification.pdf
, Page 6):
主要功能:
次要功能:
Project Specification.pdf
, Page 8
Latex, Overleaf
其他:
项目名字(待定)
下次开会?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.