Fast, unopinionated, minimalist web framework for node.
Folder Structure
.
├── App #Source file alternative(src, lib) directory
| ├── Config
| | ├── config.js #Application config file (database, secrete key, rule etc.)
| | └── web.js #define route
| ├── Controllers
| | ├── FlashController.js #Default Controller
| ├── Middleware
| ├── Models
| └── Views
├── Public #Static file directory
├── Run
| └── main.js #Executed Main file
├── boot.js #Boot file (initialize all code)
├── package.json
├── LICENSE
└── README.md
Example snippet
Create server.js in your project root folder and copy this code and past into your server.js file then open your terminal goto your project root run this command in your terminal node server.js
Awesome you just create your first flash server checkout your server work on not open your browser type localhost:3000
in browser addressbar and hit enter.
global.__basedir = __dirname; //it's required
const flash = require("@faisal50x/flash");
const app = flash();
const Router = flash.router(app);
app.get("/", function(req, res) {
res.send("Welcome to Flash world");
});
Router.group("/", function() {
Router.get("/welcome", function(req, res) {
res.send("Welcome group route");
});
Router.post("/welcome", function(req, res) {
res.send(`Welcome to ${req.path} Method ${req.method}`);
});
});
//Laravel Style Callback
Router.group("/auth", function() {
Router.post("/login", "FlashController@login");
});
//Middleware setup in group route
Router.group("/api/v1", ["Authentication", "Role"], function() {
Router.get("/user/:id/profile", "UserController@profile");
});
app.listen(3000);
Installation
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js. Node.js 8 or higher is required.
Installation is done using the
npm install
command:
$ npm install @faisal50x/flash
or
$ npm i @faisal50x/flash
Follow our installing guide for more information.
Features
- Robust routing
- Focus on high performance
- Super-high test coverage
- HTTP helpers (redirection, caching, etc)
- View system supporting 14+ template engines
- Content negotiation
- Executable for generating applications quickly
- Group routing supported (Inspired by laravel)
- Middleware supported (Inspired by laravel)
- Pre added database supported (Inspired by laravel) [mongodb, mysql, postgresql,sqlite,mssql]
- ORM Database supported (Inspired by laravel)
Docs & Community
- Website and Documentation - [website repo]
- GitHub Author for Official Middleware & Modules
- Visit the Wiki
- Gitter for support and discussion
Security Issues
If you discover a security vulnerability in Flash, please see Security Policies and Procedures [Coming Soon].
Quick Start
The quickest way to get started with flash is to utilize the executable flash(1)
to generate an application as shown below:
Install the executable. The executable's major version will match Flash's:
$ npm install -g @faisal50x/flashcli
Create the app:
$ flash new demo-app
Ready to go your project root:
$ cd demo-app
Start the server:
$ npm start
Philosophy
The Flash philosophy is to provide small, robust tooling for HTTP servers, making it a great solution for single page applications, web sites, hybrids, or public HTTP APIs.
Flash have build in ORM or template engine. With support for over 14 template engines via Consolidate.js, you can quickly craft your perfect framework.
People
The original author of Flash is Faisal Ahmed