Skip to content

Commit

Permalink
init 2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
renomureza committed Mar 13, 2022
0 parents commit 614bb25
Show file tree
Hide file tree
Showing 30 changed files with 1,921 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/lapor-bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Lapor Bug
about: Buat laporan untuk membantu kami meningkatkan
title: ''
labels: bug
assignees: ''

---

**Penjelasan bug**
Jelaskan secara ringkas bug tersebut.

**Untuk Mereproduksi**
Langkah-langkah untuk mereproduksi perilaku/bug tersebut:

1. Pergi ke '...'
2. Klik '....'
3. Gulir ke bawah '....'
4. Lihat kesalahan/bug

**Perilaku yang diharapkan**
Uraian yang jelas dan ringkas tentang apa yang Anda harapkan.

**Tangkapan layar**
Jika ada, tambahkan tangkapan layar untuk membantu menjelaskan masalah Anda.


**Konteks tambahan**
Tambahkan konteks lain tentang masalah di sini.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/permintaan-fitur-.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: 'Permintaan fitur '
about: Sarankan ide untuk proyek ini
title: ''
labels: enhancement
assignees: ''

---

**Apakah permintaan fitur Anda terkait dengan masalah? Tolong jelaskan.**
Deskripsi yang jelas dan singkat tentang apa masalahnya.

**Jelaskan solusi yang Anda inginkan**
Sebuah deskripsi yang jelas dan ringkas tentang apa yang Anda inginkan terjadi.

**Jelaskan alternatif yang telah Anda pertimbangkan**
Deskripsi yang jelas dan ringkas tentang solusi atau fitur alternatif apa pun yang telah Anda pertimbangkan.

**Konteks tambahan**
Tambahkan konteks lain tentang permintaan fitur di sini.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.env
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[email protected].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 R.M. Reza

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<div align="center">
<a href="./">
<img src="./assets/logo.png">
</a>
<h1 align="center">Quran API ID</h1>
<p align="center">
<strong>REST API Al-Quran Indonesia dengan terjemahan, tafsir (Kemenag, Quraish Shihab, Al-Jalalain), audio murottal (per surah dan ayat dari 6 qori), random ayat.</strong>
</p>
<p align="center">
<a href="https://quran-api-id.vercel.app"><strong>Demo</strong></a> · <a href="https://github.com/renomureza/quran-api-id/issues"><strong>Lapor Bug</strong></a> · <a href="https://github.com/renomureza/quran-api-id/issues"><strong>Request Fitur</strong></a>
</p>
<a href="https://github.com/renomureza/quran-api-id/graphs/contributors">
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/renomureza/quran-api-id">
</a>
<a href="https://github.com/renomureza/quran-api-id/network/members">
<img alt="GitHub forks" src="https://img.shields.io/github/forks/renomureza/quran-api-id">
</a>
<a href="https://github.com/renomureza/quran-api-id/stargazers">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/renomureza/quran-api-id">
</a>
<a href="https://github.com/renomureza/quran-api-id/issues">
<img alt="GitHub issues" src="https://img.shields.io/github/issues/renomureza/quran-api-id">
</a>
<a href="https://github.com/renomureza/quran-api-id/blob/main/LICENSE">
<img alt="GitHub license" src="https://img.shields.io/github/license/renomureza/quran-api-id">
</a>
</div>

## Fitur

Quran API ID merupakan REST API Al-Quran yang menyajikan data Al-Quran dalam bahasa Indonesia. Datanya berasal dari berbagai sumber, data tersebut digabungkan menjadi satu file JSON dengan struktur baru.

Berikut beberapa fitur Quran API ID:

- **6 Audio (murottal)**: murrotal surah yang mencakup semua ayat (dengan suara terjemahan), murottal setiap ayat dari 6 qori: Shaykh Mishari Alafasy, Ahmed ibn Ali al-Ajamy, Husary (Mujawwad), Minshawi, Muhammad Ayyoub, dan Muhammad Jibreel.
- **3 Tafsir**: tafsir setiap ayat dari Kemenag (versi panjang dan pendek), Quraish Shihab, dan Al-Jalalain.
- **Random Ayat**: untuk mendapatkan data ayat secara random.
- **Metadata**: juz, halaman, manzil, ruku, sajda, dan lainnya.
- **Deskripsi Surah**: deskripsi singkat setiap surah seperti golongan surah, jumlah ayat, asal-usul namanya.
- **Gambar Ayat**: ayat dalam gambar.
- _Punya ide attau butuh fitur lain? ajukan [permintaan fitur](https://github.com/renomureza/quran-api-id/issues)_.

## Endpoints

| Endpoint | Contoh | Deskripsi |
| ---------------------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------- |
| `/surahs` | [`/surahs`](https://quran-api-id.vercel.app/surahs) | daftar surah. |
| `/surahs/{nomorSurah}` | [`/surahs/112`](https://quran-api-id.vercel.app/surahs/112) | surah tertentu berdasarkan nomor surah (1 - 114). |
| `/surahs/{nomorSurah}/ayahs` | [`/surahs/112/ayahs`](https://quran-api-id.vercel.app/surahs/112/ayahs) | semua ayat dari surah tertentu tertentu. |
| `/surahs/{nomorSurah}/ayahs/{nomorAyat}` | [`/surahs/112/ayahs/2`](https://quran-api-id.vercel.app/surahs/112/ayahs/2) | ayat dari surah tertentu. |
| `/random` | [`/random`](https://quran-api-id.vercel.app/random) | random ayat. |

## Sumber Data

Semua data disimpan di [folder data](https://github.com/renomureza/quran-api-id/tree/main/data), data di folder tmp adalah data mentah, `quran.json` adalah data yang sudah jadi.

Berikut beberapa sumber data yang digunakan:

- [Al-Quran Kemenag](https://quran.kemenag.go.id) (prioritas): nama surah, terjemahan ayat, tafsir Kemenag, dll.
- [Al Quran Cloud](https://alquran.cloud): Metadata, audio ayah.
- [Tanzil](https://tanzil.net/docs/): Tafsir Quraish Shihab dan Al-Jalalain.
- [Al-Quran-ID-API](https://github.com/bachors/Al-Quran-ID-API): deskripsi surah dan audio surah.

## Daftar Perintah (Command)

- `yarn start` - menjalankan server.
- `yarn dev` - menjalankan server pengembangan.
- `yarn build:quran` - untuk membangun ulang data quran utama.

## License

Licensed under [MIT](https://opensource.org/licenses/MIT).
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions config/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const dotenv = require("dotenv");
const path = require("path");

dotenv.config({ path: path.join(process.cwd(), ".env") });

module.exports = {
BASE_URL: process.env.BASE_URL || "http://localhost:3005",
PORT: process.env.PORT || 3005,
};
37 changes: 37 additions & 0 deletions controllers/home.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const config = require("../config/config");

const endpoints = [
{
path: `${config.BASE_URL}/surahs`,
description: "get all surah: /surahs",
},
{
path: `${config.BASE_URL}/surahs/112`,
description:
"get spesifict surah using number surah in quran (1 - 114): /surahs/{numberSurah}",
},
{
path: `${config.BASE_URL}/surahs/112/ayahs`,
description:
"get all ayah from spesifict surah: /surahs/{numberSurah}/ayahs",
},
{
path: `${config.BASE_URL}/surahs/112/ayahs/2`,
description:
"get spesifict ayah from spesifict surah: /surahs/{numberSurah}/ayahs/{numberAyah}",
},
{
path: `${config.BASE_URL}/random`,
description: "get random ayah: /random",
},
];

const home = (req, res) => {
res.json({
endpoints,
maintainer: "R.M. Reza ([email protected])",
source: "https://github.com/renomureza/quran-api-id/",
});
};

module.exports = { home };
10 changes: 10 additions & 0 deletions controllers/random.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const quran = require("../data/quran.json");
const { responseJson, getRandomInt } = require("../utils/utility");

const random = (req, res) => {
const surah = quran[getRandomInt(1, 114) - 1];
const ayah = surah.ayahs[getRandomInt(1, surah.ayahs.length) - 1];
res.json(responseJson(ayah, "random ayah was retrieved successfully", true));
};

module.exports = { random };
36 changes: 36 additions & 0 deletions controllers/surahs.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const quran = require("../data/quran.json");
const { responseJson } = require("../utils/utility");

const getSurahs = (req, res) => {
const data = quran.map(({ ayahs, bismillah, ...rest }) => rest);
res.json(responseJson(data, "surahs was retrieved successfully", true));
};

const getSurah = (req, res) => {
const { surahNumber } = req.params;
const data = quran[Number(surahNumber) - 1];
if (!data) {
return res.status(404).json(responseJson(null, "surah not found", false));
}
res.json(responseJson(data, "surah was retrieved successfully", true));
};

const getAyahs = (req, res) => {
const { surahNumber } = req.params;
const data = quran[Number(surahNumber) - 1]?.ayahs;
if (!data) {
return res.status(404).json(responseJson(null, "surah not found", false));
}
res.json(responseJson(data, "ayahs was retrieved successfully", true));
};

const getAyah = (req, res) => {
const { surahNumber, ayahNumber } = req.params;
const data = quran[Number(surahNumber) - 1]?.ayahs[Number(ayahNumber) - 1];
if (!data) {
return res.status(404).json(responseJson(null, "ayah not found", false));
}
res.json(responseJson(data, "ayah was retrieved successfully", true));
};

module.exports = { getSurahs, getSurah, getAyahs, getAyah };
1 change: 1 addition & 0 deletions data/quran.json

Large diffs are not rendered by default.

Loading

1 comment on commit 614bb25

@vercel
Copy link

@vercel vercel bot commented on 614bb25 Mar 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.