Skip to content

Commit aea8c75

Browse files
Update README.md
1 parent 7b146cc commit aea8c75

File tree

1 file changed

+72
-3
lines changed

1 file changed

+72
-3
lines changed

README.md

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,78 @@
1-
steps
1+
# Sample gRPC Node.js News Server
22

3-
```
3+
## Overview
4+
5+
This repository contains a gRPC-based Node.js server implementing CRUD operations for a news list. It features a batched `GetNews` API, allowing efficient retrieval of multiple news items.
6+
7+
### Features
8+
9+
- **CRUD Operations**: Create, Read, Update, and Delete news items.
10+
- **Batched News Retrieval**: Fetch multiple news items in a single request.
11+
- **gRPC Interface**: Efficient and modern protocol for inter-service communication.
12+
13+
## Prerequisites
14+
15+
Before you begin, ensure you have installed:
16+
- [Node.js](https://nodejs.org/en/download/)
17+
- [npm](https://www.npmjs.com/get-npm)
18+
19+
## Installation
20+
21+
To set up the project, run the following command:
22+
23+
```bash
424
npm install
525
```
626

7-
```
27+
## Running the Server
28+
29+
Start the server with:
30+
31+
```bash
832
node server
933
```
34+
35+
## gRPC API
36+
37+
The server uses the following gRPC API defined in `news.proto`:
38+
39+
```protobuf
40+
syntax = "proto3";
41+
import "google/protobuf/empty.proto";
42+
43+
message News {
44+
int32 id = 1;
45+
string title = 2;
46+
string body = 3;
47+
string postImage = 4;
48+
}
49+
50+
service NewsService {
51+
rpc GetAllNews (google.protobuf.Empty) returns (NewsList) {}
52+
rpc GetNews (NewsId) returns (News) {}
53+
rpc GetMultipleNews (MultipleNewsId) returns (NewsList) {}
54+
rpc DeleteNews (NewsId) returns (google.protobuf.Empty) {}
55+
rpc EditNews (News) returns (News) {}
56+
rpc AddNews (News) returns (News) {}
57+
}
58+
59+
message NewsId {
60+
int32 id = 1;
61+
}
62+
63+
message MultipleNewsId {
64+
repeated NewsId ids = 1;
65+
}
66+
67+
message NewsList {
68+
repeated News news = 1;
69+
}
70+
```
71+
72+
## License
73+
74+
This project is licensed under the MIT License.
75+
76+
* * *
77+
78+
© 2023 @ Tailcall

0 commit comments

Comments
 (0)