@wingaru/appify
v0.0.16
Published
A simple yet powerful web application framework
Downloads
199
Readme
Appify
New web framework for simplification and security in mind.
QuickStart
- Clone the project
- Install dependencies
npm install
Run Docs
npx docsify serve docs
Architecture
Here are the plugins and what they do
packages/mdx
(mdixfy) - an appify plugin that serves the public directory relative to project directorypackages/admin
(adminify) - an appify plugin that serves the built-in admin project and manages the content in the public directorypackages/autoload
(autofy) - an appify plugin that auloads theroutes
folder relative to the project directorypackages/http
- a simple fetch wrapper used in appify web componentspackages/dal
- a Data Access Layer used to get data from MySQL or Postgrespackages/localapi
- TBA
Switch to branch
git branch -r # list remotes git checkout -b feature/100-feature-name origin/feature/100-feature-name
How to build
For a first time bundling of appify
npm run build
ES6 Module Template
/**
* ES6 Module Template
*
* This file demonstrates the structure of an ES6 module, including export and import syntax.
*
* ES6 Module Cheatsheet:
* - Default Export: export default <expression>;
* - Named Export: export { <name> };
* - Renamed Export: export { <originalName> as <newName> };
* - Importing a Default Export: import <name> from '<module>';
* - Importing Named Exports: import { <name> } from '<module>';
* - Importing All as an Object: import * as <name> from '<module>';
* - Renaming Imports: import { <originalName> as <newName> } from '<module>';
*/
/**
* A simple function to demonstrate named export.
* @param {number} a - First operand.
* @param {number} b - Second operand.
* @returns {number} The sum of a and b.
*
* Example:
* import { add } from './es6-module-template';
* console.log(add(2, 3)); // Output: 5
*/
export function add(a, b) {
return a + b;
}
/**
* A function to demonstrate default export.
* @param {number} a - Base number.
* @param {number} exponent - Exponent value.
* @returns {number} The result of a raised to the power of exponent.
*
* Example:
* import power from './es6-module-template';
* console.log(power(2, 3)); // Output: 8
*/
export default function power(a, exponent) {
return Math.pow(a, exponent);
}
/**
* A function to demonstrate export renaming.
* @param {string} str - Input string.
* @returns {string} The string in uppercase.
*
* Example:
* import { upperCase as uc } from './es6-module-template';
* console.log(uc('hello')); // Output: 'HELLO'
*/
export function upperCase(str) {
return str.toUpperCase();
}
CommonJs Module Template
// /path/to/commonjs-module-template.js
/**
* CommonJS Module Template
*
* This file demonstrates the structure of a CommonJS module, commonly used in Node.js environments.
*
* CommonJS Module Cheatsheet:
* - Exporting: module.exports = <expression>;
* - Named Exports: exports.<name> = <value>;
* - Importing: const <name> = require('<module>');
*/
/**
* A simple function to demonstrate named export in CommonJS.
* @param {number} a - First operand.
* @param {number} b - Second operand.
* @returns {number} The sum of a and b.
*
* Example:
* const { add } = require('./commonjs-module-template');
* console.log(add(2, 3)); // Output: 5
*/
exports.add = function (a, b) {
return a + b;
};
/**
* A function to demonstrate default export in CommonJS.
* @param {number} a - Base number.
* @param {number} exponent - Exponent value.
* @returns {number} The result of a raised to the power of exponent.
*
* Example:
* const power = require('./commonjs-module-template').power;
* console.log(power(2, 3)); // Output: 8
*/
exports.power = function (a, exponent) {
return Math.pow(a, exponent);
};
/**
* A function to showcase additional named export.
* @param {string} str - Input string.
* @returns {string} The string in uppercase.
*
* Example:
* const { upperCase } = require('./commonjs-module-template');
* console.log(upperCase('hello')); // Output: 'HELLO'
*/
exports.upperCase = function (str) {
return str.toUpperCase();
};