Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
martiendt committed Mar 30, 2022
0 parents commit 36c8a27
Show file tree
Hide file tree
Showing 32 changed files with 1,087 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"env": {
"test": {
"plugins": ["@babel/plugin-transform-modules-commonjs", "dynamic-import-node"]
}
}
}
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SERVER CONFIGURATION
NODE_ENV=development
APP_NAME=pointapidocs
DOMAIN=localhost:3000
PORT=3000

49 changes: 49 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
module.exports = {
env: {
browser: true,
commonjs: true,
node: true,
es2021: true,
jest: true,
},
plugins: ["prettier", "import"],
extends: ["plugin:prettier/recommended", "plugin:import/recommended"],
parserOptions: {
ecmaVersion: 12,
sourceType: "module",
},
rules: {
"prettier/prettier": ["error", { endOfLine: "auto", printWidth: 120 }],
"import/order": [
"error",
{
alphabetize: {
order: "asc",
caseInsensitive: false,
},
pathGroups: [
{
pattern: "~/**",
group: "external",
},
],
},
],
},
settings: {
"import/resolver": {
/**
* Since using "subpath patterns" makes an eslint error
* https://nodejs.org/api/packages.html#packages_subpath_patterns
* https://github.com/import-js/eslint-plugin-import/issues/1868
* We use custom resolver to solve this issue
* https://www.npmjs.com/package/eslint-import-resolver-custom-alias
*/
"eslint-import-resolver-custom-alias": {
alias: {
"#src": "./src",
},
},
},
},
};
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Envorinment variable
.env
.env.**.local

# Npm
node_modules
package-lock.json

coverage
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": [
"javascript"
],
"javascript.format.enable": false,
}
5 changes: 5 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Copyright (c) 2021 PointHub

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Point API Docs

![Logo](/src/assets/logo.png)

## Overview

This is a boilerplate application for building REST APIs in Node.js using ES6 and Express. Helps you stay productive by following best practices.
### Quick Start
```
git clone [email protected]:point-red/api-docs.git
cd api-docs
cp .env.example .env
npm i
npm run dev
```
1 change: 1 addition & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "@exmodule/cli";
13 changes: 13 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Api Documentation

## Guide

Install Visual Studio Code Extension

https://marketplace.visualstudio.com/items?itemName=42Crunch.vscode-openapi

## Reference

- Spec : https://swagger.io/specification/
- UI : https://github.com/Redocly/redoc
- CLI : https://redoc.ly/docs/redoc/quickstart/cli/
21 changes: 21 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>Point API Docs</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">

<!-- Redoc doesn't change outer page styles -->
<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<redoc spec-url="/assets/api-docs/v1/bundled/openapi.yml"></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@latest/bundles/redoc.standalone.js"> </script>
</body>
</html>
49 changes: 49 additions & 0 deletions docs/v1/admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
get:
tags:
- Admin
summary: Read all admin
description: lorem ipsum
parameters:
- name: started
required: true
in: query
description: filter joined admin
schema:
type: date
example: '2022-02-22T00:00:00.0000Z'
- name: ended
required: true
in: query
description: filter joined admin
schema:
type: date
example: '2022-02-24T00:00:00.0000Z'
- name: timezone
in: query
description: setup timezone response
schema:
type: string
default: UTC
example: Asia/Jakarta
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 0
data:
type: array
items:
type: object
properties:
name:
type: string
example: 90
address:
type: string
example: 100
114 changes: 114 additions & 0 deletions docs/v1/bundled/openapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
openapi: 3.0.3
info:
title: Point API Docs
description: >
# Introduction
This API is documented in **OpenAPI format**, You can find more information
:
- **Specs:**
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsObject
- **Basic Structure:**
https://swagger.io/docs/specification/basic-structure/
- **Tutorial:**
https://support.smartbear.com/swaggerhub/docs/tutorials/openapi-3-tutorial.html
# Cross-Origin Resource Sharing
This API features Cross-Origin Resource Sharing (CORS) implemented in
compliance with [W3C spec](https://www.w3.org/TR/cors/).
And that allows cross-domain communication from the browser.
All responses have a wildcard same-origin which makes them completely public
and accessible to everyone, including any code on any site.
# Authentication
Ex-Module offers two forms of authentication:
- Local Authentication
- Json Web Token
x-logo:
url: http://localhost:3000/assets/logo.png
altText: Ex-Module logo
contact:
name: API Support
email: [email protected]
url: https://github.com/Redocly/redoc
license:
name: MIT
url: https://opensource.org/licenses/MIT
version: 0.0.1
servers:
- url: https://api.point.red/v1
description: Production Server
tags:
- name: Admin
description: >-
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the
1500s, when an unknown printer took a galley of type and scrambled it to
make a type specimen book. It has survived not only five centuries, but
also the leap into electronic typesetting, remaining essentially
unchanged. It was popularised in the 1960s with the release of Letraset
sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem
Ipsum.
paths:
/admins:
get:
tags:
- Admin
summary: Read all admin
description: lorem ipsum
parameters:
- name: started
required: true
in: query
description: filter joined admin
schema:
type: date
example: '2022-02-22T00:00:00.0000Z'
- name: ended
required: true
in: query
description: filter joined admin
schema:
type: date
example: '2022-02-24T00:00:00.0000Z'
- name: timezone
in: query
description: setup timezone response
schema:
type: string
default: UTC
example: Asia/Jakarta
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 0
data:
type: array
items:
type: object
properties:
name:
type: string
example: 90
address:
type: string
example: 100
components: {}
40 changes: 40 additions & 0 deletions docs/v1/index.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
openapi: 3.0.3
info:
title: Point API Docs
description: |
# Introduction
This API is documented in **OpenAPI format**, You can find more information :
- **Specs:** https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsObject
- **Basic Structure:** https://swagger.io/docs/specification/basic-structure/
- **Tutorial:** https://support.smartbear.com/swaggerhub/docs/tutorials/openapi-3-tutorial.html
# Cross-Origin Resource Sharing
This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/).
And that allows cross-domain communication from the browser.
All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
# Authentication
Ex-Module offers two forms of authentication:
- Local Authentication
- Json Web Token
x-logo:
url: http://localhost:3000/assets/logo.png
altText: Ex-Module logo
contact:
name: API Support
email: [email protected]
url: https://github.com/Redocly/redoc
license:
name: MIT
url: https://opensource.org/licenses/MIT
version: 0.0.1
servers:
- url: https://api.point.red/v1
description: Production Server
tags:
- name: Admin
description: Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
paths:
/admins:
$ref: './admin.yml'
Loading

0 comments on commit 36c8a27

Please sign in to comment.