# gratis-server

> A node REST api service

Latest version **1.0.4** (published 2019-01-13) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install gratis-server
pnpm add gratis-server
yarn add gratis-server
bun add gratis-server
```

Provides the command `gratis-server`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2019-01-13 |
| First published | 2019-01-13 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 1.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | sahith vibudhi |
| Maintainers | sahithvibudhi |
| Keywords | REST, byofe, backend, as, a, service |

## Links

- npm: https://www.npmjs.com/package/gratis-server
- Repository: https://github.com/sahithvibudhi/gratis
- Homepage: https://github.com/sahithvibudhi/gratis#readme
- Issues: https://github.com/sahithvibudhi/gratis/issues
- npm.io page: https://npm.io/package/gratis-server

## Dependencies (12)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [dotenv](https://npm.io/package/dotenv.md) ^6.1.0
- [figlet](https://npm.io/package/figlet.md) ^1.2.1
- [express](https://npm.io/package/express.md) ^4.16.4
- [mongodb](https://npm.io/package/mongodb.md) ^3.0.2
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [body-parser](https://npm.io/package/body-parser.md) ^1.18.3
- [querystring](https://npm.io/package/querystring.md) ^0.2.0
- [finalhandler](https://npm.io/package/finalhandler.md) ^1.1.1
- [randomstring](https://npm.io/package/randomstring.md) ^1.1.5
- [serve-static](https://npm.io/package/serve-static.md) ^1.13.2
- [async-request](https://npm.io/package/async-request.md) ^1.2.0

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2019-01-13
- 1.0.3 — 2019-01-13
- 1.0.2 — 2019-01-13
- 1.0.1 — 2019-01-13
- 1.0.0 — 2019-01-13

## README

# gratis
An open-source, easy-to-customize back-end service right out of the box. Write your front-end let gratis handle the Back-end. ⚡

![How to use](quick-start.gif)

1. [Quick Start](#-quick-start)
2. [ How to Use?](#-how-to-use)
3. [How to Setup Project in your local environment?](#-how-to-setup-project-in-your-local-environment)

# 🚀 Quick Start

1. Install Gratis

```
npm install -g gratis-server
```

2. Start server

```
gratis-server --port 9000 --dburl mongodb://localhost:32770 --log true
```

That's it 💁‍♂️

# 📖 How to Use?

__To Insert Records:__

```
curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"name":"t-series","subscribers":"78,000,000", "region":"asia"}' \
  http://localhost:3000/youtube/channels
```

---

__To Fetch Records:__

```
curl --request GET \
  http://localhost:3000/youtube/channels
# returns max 20 records
```

Querying data
```
curl --request GET \
  http://localhost:3000/youtube/channels?region=asia&sort=-subscribers&limit=5
```

---

__To Update Records:__
```
curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"name":"t-series","subscribers":"79,000,000", "region":"asia"}' \
  http://localhost:3000/youtube/channels?name=t-series
```

---

__To Delete Recrods:__
```
curl --request DELETE \
  http://localhost:3000/youtube/channels?name=t-series
```

---

## How to Setup Project in your local environment?
```
git clone https://github.com/sahithvibudhi/gratis.git
cd gratis
npm install
node index.js
```

> NOTE: Gratis needs a MongoDB server to store the data 💾.

To run it on a specific port. use:
```
node index.js --port 9000
```

To pass the database connection URL. use:
```
node index.js --port 9000 --dburl mongodb://localhost:32770 
```

To enable logging, use:
```
node index.js --port 9000 --dburl mongodb://localhost:32770 --log true
```

Gratis comes with a GUI to create new apps, to enable, use:
```
node index.js --dburl mongodb://localhost:32770 --log true --dashboard true
```

# TODO:
- Adapter to use different Data Stores
- Adapter to use different loggers
- Make auth Optional

---

<center> Built with ❤️ for front-end Developers </center>

---
_Source: https://npm.io/package/gratis-server · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
