Steps to run this project:
- Run
npm install
command - Run
npm start
command - Open
http://localhost:3000/messages
in browser
- Run
npm test
command
GET http://localhost:3000/channels
Result:
{
"code": 0,
"message": "success",
"data": {
"id": 1,
"name": "xxxx"
}
}
POST http://localhost:3000/channels
Body:
Name | Type | Optional |
---|---|---|
name | String | No |
GET http://localhost:3000/messages
Parameters:
Name | Type | Default | Optional |
---|---|---|---|
page | Int | 1 | Yes |
page_size | Int | 10 | Yes |
channel_id | Int | 0 | Yes |
Result:
{
"code": 0,
"message": "success",
"data": [
{
"id": 1,
"title": "hello world!",
"content": "This is my first message.",
"createdAt": "2022-08-08T08:28:42.000Z",
"updatedAt": "2022-08-08T08:28:42.000Z",
"channel": {
"id": 1,
"name": "Life",
"createdAt": "2022-08-08T08:28:42.000Z",
"updatedAt": "2022-08-08T08:28:42.000Z"
}
}
],
"total": 4,
"page_size": 10,
"page": 1,
"total_page": 1
}
POST http://localhost:3000/messages
Body:
Name | Type | Optional |
---|---|---|
channel_id | Int | No |
title | String | No |
content | String | No |