Skip to content

Commit

Permalink
Update readme: docker-compose and mongorestore
Browse files Browse the repository at this point in the history
  • Loading branch information
deprov447 committed Mar 26, 2024
1 parent c33a38a commit 7ba3889
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 42 deletions.
52 changes: 27 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,25 @@
<img src="./src/frontend/static/fullLength.png" width="350" height="80"/>

![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/deprov447/median-api/Node.js%20CI/master?style=for-the-badge)
![GitHub deployments](https://img.shields.io/github/deployments/deprov447/median-api/server-median?label=Deployment%20state&style=for-the-badge)

![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/deprov447/median-api?style=for-the-badge)
![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/deprov447/median-api?style=for-the-badge)
![GitHub](https://img.shields.io/github/license/deprov447/median-server?style=for-the-badge)

A GraphQL based feature rich blogging API.

See full documentation [HERE](https://median-api.deprov447.me) for API docs, configuration and deployment options.
See full documentation [HERE](https://median-api-docs.netlify.app/) for API docs, configuration and deployment options.

---

# Features

## Lightweight

Median API is very lightweight as compared to other REST based API. And the main reason is that you get only the content you request for, which is not possible (or atleast cumbersome) in REST architecture.

For example if you only want titles of top 3 blogs, you can just pass a query like this and in response you only get those 5 respective titles:

[![recording89f7c02ede6efed0.gif](https://s9.gifyu.com/images/recording89f7c02ede6efed0.gif)](https://gifyu.com/image/J5h1)

## Platform Agnostic
## Local Setup

The API is fully platform agnostic, ie any client on any platform can use this API. These include React application, Angular, Electron, Flutter, Native desktop apps on Qt etc. The possibilities are endless.
> Optional: import demo data in your mongo instance `mongorestore --verbose ./db-demo`
> Even if your platform doesnt have a library to make graphQL based request, you can use Median. See: (a blog reg this)
### Docker

## Open Source
- `docker compose up`
> Make changes in `docker-compose.yml` if required
The API is fully open source, you can freely host it on your own server with all the customizations you want.

---

## Local Setup
### Local machine

- Clone this repo: `git clone https://github.com/deprov447/median-server`
- Run `npm install`
Expand All @@ -46,9 +30,27 @@ The API is fully open source, you can freely host it on your own server with all
- **DB_ADDR** : _< Mongo database connection URI >_
- **SECRET** : _< Secret key for signing auth tokens >_
- Start the server: `npm start`
- Start requesting from a client (eg: [playground](https://median-api.deprov447.me/client))
- Start requesting from a client (eg: `http://localhost:<PORT>/client`)

> Or the same can be done using [docker](https://hub.docker.com/r/deprov447/median-api) also: `docker pull deprov447/median-api`
[Dockerhub](https://hub.docker.com/r/deprov447/median-api):`docker pull deprov447/median-api`

---

# Features

## Lightweight

Median API is very lightweight as compared to other REST based API. And the main reason is that you get only the content you request for, which is not possible (or atleast cumbersome) in REST architecture.

## Platform Agnostic

The API is fully platform agnostic, ie any client on any platform can use this API. These include React application, Angular, Electron, Flutter, Native desktop apps on Qt etc. The possibilities are endless.

> Even if your platform doesnt have a library to make graphQL based request, you can use Median. See: (a blog reg this)
## Open Source

The API is fully open source, you can freely host it on your own server with all the customizations you want.

---

Expand Down
7 changes: 7 additions & 0 deletions src/frontend/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ type: docs

A GraphQL based feature rich blogging API.

# Quick try

- Clone the source code `git clone https://github.com/deprov447/Median-API.git`
- Run docker containers `docker compose up`
- Open [http://localhost:8000/client](http://localhost:8000/client) in a browser and enter `http://localhost:8000/gql` in request url
- Play around

## Lightweight

Median API is very lightweight as compared to other REST based API. And the main reason is that you get only the content you request for, which is not possible (or atleast cumbersome) in REST architecture.
Expand Down
6 changes: 5 additions & 1 deletion src/frontend/content/docs/v1/env_var.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ weight: 20

The method to set environment variables depends mostly on what system you are using / where the server is deployed. But here are a few ways to set env variables:

### Docker Compose

Make required changes in `docker-compose.yml`

### Local System

#### CLI
Expand Down Expand Up @@ -61,4 +65,4 @@ DEPTH_LIMIT = 3

The method to set environment variables differs for every hosting provider, but most probably you can set variables from the dashboard of your hosting provider.

For example, in Heroku you can do [this](https://devcenter.heroku.com/articles/config-vars#using-the-heroku-dashboard).
For example, in Heroku you can do [this](https://devcenter.heroku.com/articles/config-vars#using-the-heroku-dashboard).
26 changes: 10 additions & 16 deletions src/frontend/content/docs/v1/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ weight: 10

# Setup

## Docker Compose

**Prerequisites**
- [Docker](https://docs.docker.com/get-docker/)

**Steps to Setup**
- Clone the repo
- Make required changes to `docker-compose.yml`
- Run `docker compose up`

## Local server

**Prerequisites :**
Expand All @@ -20,19 +30,3 @@ weight: 10
- `npm install` : Install all the required node dependencies
- `(cd src/frontend && hugo)` : Generate static front pages
- `npm start`

## Docker

**Prerequisites**
- [Docker](https://docs.docker.com/get-docker/)

**Steps to setup**

You can pull the latest version of Median from [Docker Hub](https://hub.docker.com/r/deprov447/median-api).
Use `docker pull deprov447/median-api`

**or else build your own image**:
- `git clone https://github.com/deprov447/median-api` : Clone the repo to your machine
- `cd median-api`
- `docker build --network=host -t median-api .` : Build the image
- `docker run --net=host median-api` : Start image

0 comments on commit 7ba3889

Please sign in to comment.