Skip to content

Commit ade9f87

Browse files
committed
Initial commit
0 parents  commit ade9f87

File tree

612 files changed

+90873
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

612 files changed

+90873
-0
lines changed

.github/FUNDING.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: [foyzulkarim]
4+
patreon: foyzulkarim
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: ["https://paypal.me/foyzul"] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/node.js.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [develop]
9+
pull_request:
10+
branches: [develop]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [16.x]
19+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: "npm"
28+
- run: npm ci
29+
working-directory: server

.gitignore

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port
105+
106+
.DS_Store
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
{
2+
// Place your rbac-antd-mern-boilerplate workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3+
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4+
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5+
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
7+
// Placeholders with the same ids are connected.
8+
// Example:
9+
"My Print to console": {
10+
"scope": "javascript,typescript",
11+
"prefix": "log",
12+
"body": ["console.log('$1');", "$2"],
13+
"description": "My Log output to console"
14+
},
15+
16+
"Add controller": {
17+
"scope": "javascript,typescript",
18+
"prefix": "mbcontroller",
19+
"body": [
20+
"const express = require(\"express\");",
21+
"const { getQuery } = require(\"./service\");",
22+
"const {",
23+
" getByIdHandler,",
24+
" saveHandler,",
25+
" updateHandler,",
26+
" searchHandler: baseSearchHandler,",
27+
" countHandler: baseCountHandler,",
28+
" deleteHandler,",
29+
"} = require(\"../../core/controller\");",
30+
"const { validate } = require(\"./request\");",
31+
"const { handleValidation } = require(\"../../common/middlewares\");",
32+
"\n",
33+
"const router = express.Router();",
34+
"const searchHandler = async (req, res, next) => {",
35+
" req.searchQuery = getQuery(req.body);",
36+
" return baseSearchHandler(req, res, next);",
37+
"};",
38+
"const countHandler = async (req, res, next) => {",
39+
"\treq.searchQuery = getQuery(req.body);",
40+
"\treturn baseCountHandler(req, res, next);",
41+
"};",
42+
"router.get(\"/detail\", getByIdHandler);",
43+
"router.post(\"/create\", handleValidation(validate), saveHandler);",
44+
"router.put(\"/update\", handleValidation(validate), updateHandler);",
45+
"router.post(\"/search\", searchHandler);",
46+
"router.post(\"/count\", countHandler);",
47+
"router.delete(\"/delete\", deleteHandler);",
48+
"module.exports = router;",
49+
"\n"
50+
],
51+
"description": "Mern boilerplate controller"
52+
},
53+
"Add index": {
54+
"scope": "javascript,typescript",
55+
"prefix": "mbindex",
56+
"body": [
57+
"const routes = require(\"./controller\");",
58+
"const {",
59+
" authenticateRequest,",
60+
" authorizeRequest,",
61+
"} = require(\"../../common/middlewares\");",
62+
"",
63+
"const { name: ModelName } = require(\"./model\");",
64+
"",
65+
"const processRequest = async (req, res, next) => {",
66+
" req.modelName = ModelName;",
67+
" return next();",
68+
"};",
69+
"",
70+
"const init = async (app) => {",
71+
" app.use(",
72+
" \"/api/${1:apisuffix}\",",
73+
" authenticateRequest,",
74+
" authorizeRequest,",
75+
" processRequest,",
76+
" routes",
77+
" );",
78+
" return app;",
79+
"};",
80+
"",
81+
"module.exports = { init };",
82+
""
83+
],
84+
"description": "Mern boilerplate index"
85+
},
86+
"Add model": {
87+
"scope": "javascript,typescript",
88+
"prefix": "mbmodel",
89+
"body": [
90+
"const mongoose = require(\"mongoose\");",
91+
"",
92+
"// schema",
93+
"const schema = new mongoose.Schema(",
94+
" {",
95+
" // add properties here. below is a sample property",
96+
" // name: { type: String, unique: true, required: true },",
97+
" },",
98+
" { timestamps: true }",
99+
");",
100+
"",
101+
"// indices",
102+
"// text index for name",
103+
"schema.index({ name: \"text\" });",
104+
"",
105+
"// index for createdAt and updatedAt",
106+
"schema.index({ createdAt: 1 });",
107+
"schema.index({ updatedAt: 1 });",
108+
"",
109+
"module.exports = mongoose.model(\"${1:modelName}\", schema);",
110+
""
111+
],
112+
"description": "Mern boilerplate model"
113+
},
114+
"Add request": {
115+
"scope": "javascript,typescript",
116+
"prefix": "mbrequest",
117+
"body": [
118+
"const Joi = require(\"joi\");",
119+
"",
120+
"const schema = Joi.object().keys({",
121+
" _id: Joi.string().optional(),",
122+
" // sample joi validation below",
123+
" // name: Joi.string().min(2).max(30).required(),",
124+
"});",
125+
"",
126+
"const validate = (data) => {",
127+
" const result = schema.validate(data);",
128+
" result.value = data;",
129+
" return result;",
130+
"};",
131+
"",
132+
"module.exports = { validate };",
133+
""
134+
],
135+
"description": "Mern boilerplate request"
136+
},
137+
"Add service": {
138+
"scope": "javascript,typescript",
139+
"prefix": "mbservice",
140+
"description": "Mern boilerplate service",
141+
"body": [
142+
"const getQuery = (payload) => {",
143+
" let query = {};",
144+
" // example query generation of name and alias. change it according to the need",
145+
" // if (payload.name) {",
146+
" // query = {",
147+
" // $or: [",
148+
" // { name: { $regex: payload.name, $options: \"i\" } },",
149+
" // { alias: { $regex: payload.name, $options:\"i\" } },",
150+
" // ],",
151+
" // };",
152+
" // }",
153+
" return query;",
154+
"};",
155+
"",
156+
"module.exports = {",
157+
" getQuery,",
158+
"};",
159+
""
160+
]
161+
}
162+
}

.vscode/settings.json

Whitespace-only changes.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Foyzul Karim
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)