Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jewel109/blog-server
Blog Api with end to end testing for user to following other user, create blog post , real time news feed , notifications. Used event driven architecture in kafka, elasticsearch for fast search , mongodb for data storage and redis for caching
https://github.com/jewel109/blog-server
docker-compose elasticsearch endtoendtesting jest kafka mongodb redis rest-api tyepscript unit-testing
Last synced: 4 days ago
JSON representation
Blog Api with end to end testing for user to following other user, create blog post , real time news feed , notifications. Used event driven architecture in kafka, elasticsearch for fast search , mongodb for data storage and redis for caching
- Host: GitHub
- URL: https://github.com/jewel109/blog-server
- Owner: jewel109
- Created: 2024-07-08T03:01:35.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-10-07T05:04:16.000Z (about 1 month ago)
- Last Synced: 2024-10-11T04:41:49.569Z (27 days ago)
- Topics: docker-compose, elasticsearch, endtoendtesting, jest, kafka, mongodb, redis, rest-api, tyepscript, unit-testing
- Language: TypeScript
- Homepage:
- Size: 426 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Blog API Uses
- allows users to following each other after getting authorized
- allows users to creating blog posts
- allows users to access real-time news feed
- allows users to receive instant notifications
- used event driven architecture
- End to End test to all the api# Installation
Docker-compose is used for installing mongodb, elastic search, redis, kafka
you can build and run the container after cloning the repo by following command
```shell
docker compose up --build
```you can install the dependencies of the api by running
```shell
pnpm install # pnpm must be in your path if not use npm```
You have to need a **env** file to run the server and you have to keep the env file in `config` directory.
just copy the `.env.example` to `.config/test.env`
Then run
```shell
pnpm start
```Finally go to other terminal and run
```shell
pnpm run consume # kafka consumer will subscripe to topics and handle the messages
```Now the api server is ready
For Test you can run
```shell
npm test
```## Technology used
kafkajs,nodejs redis client, nodejs elastic search client , mongoose, expressjs, typescript, jsonwebtoken
## Api end points are bellow
**For Register**
`POST http://localhost:3025/api/v1/register`
request body```json
{
"name": "jewel", "email": "[email protected]", "password": "1253"
}
```**For Login**
`POST http://localhost:3025/api/v1/login`
request body```json
{
"email": "[email protected]", "password": "1253"
}
```**For following a User**
`POST http://localhost:3025/api/v1/me/follow`
request body```json
{
"followeeEmail": "[email protected]",
}
```Request Header
```shell
Authorization: bearer token
```