All Projects → maxzod → palace

maxzod / palace

Licence: MIT license
server side framework for dart inspired by express.js

Programming Languages

dart
5743 projects
shell
77523 projects

Projects that are alternatives of or similar to palace

open route service
An encapsulation made around openrouteservice API for Dart and Flutter projects. Made for easy generation of Routes and Directions on Maps, Isochrones, Time-Distance Matrix, Pelias Geocoding, POIs, Elevation and routing Optimizations using their amazing API.
Stars: ✭ 20 (-37.5%)
Mutual labels:  dart-library, dart-package
material-color-utilities
Color libraries for Material You
Stars: ✭ 605 (+1790.63%)
Mutual labels:  dart-library, dart-package
validated
Ultimate dart / flutter string validators 💃💃
Stars: ✭ 21 (-34.37%)
Mutual labels:  dart-library, dart-package
l
Cross-platform html/io [L]ogger with simple API.
Stars: ✭ 26 (-18.75%)
Mutual labels:  dart-library, dart-package
dart-emoji
A light-weight Emoji 📦 for Dart & Flutter with all up-to-date emojis written in pure Dart 😄 . Made from 💯% ☕ with ❤️!
Stars: ✭ 16 (-50%)
Mutual labels:  dart-library, dart-package
Motion-Tab-Bar
A beautiful animated flutter widget package library. The tab bar will attempt to use your current theme out of the box, however you may want to theme it.
Stars: ✭ 237 (+640.63%)
Mutual labels:  dart-library, dart-package
stash
Key-value store abstraction with plain and cache driven semantics and a pluggable backend architecture.
Stars: ✭ 71 (+121.88%)
Mutual labels:  dart-library, dart-package
Flogs
An Advanced Logging Framework develop in flutter that provides quick & simple logging solution.
Stars: ✭ 158 (+393.75%)
Mutual labels:  dart-library, dart-package
credit card validator
A Dart package that validates credit card numbers, expiration dates, and security codes (CVV/CVC) based on the type of credit card
Stars: ✭ 19 (-40.62%)
Mutual labels:  dart-library, dart-package
crypton
A simple Dart library for asymmetric encryption and digital signatures
Stars: ✭ 25 (-21.87%)
Mutual labels:  dart-library, dart-package
Getwidget
Most popular and easy to use open source UI library with 1000+ Widgets to build flutter app.
Stars: ✭ 2,555 (+7884.38%)
Mutual labels:  dart-library, dart-package
dartexif
Dart package to decode Exif data from tiff, jpeg and heic files
Stars: ✭ 16 (-50%)
Mutual labels:  dart-library, dart-package
flutter sliding tutorial
User onboarding library with smooth animation of objects and background colors
Stars: ✭ 127 (+296.88%)
Mutual labels:  dart-library, dart-package
formz
A unified form representation in Dart used at Very Good Ventures 🦄
Stars: ✭ 262 (+718.75%)
Mutual labels:  dart-package
dart-tags
ID3 Tag parser written on the pure dart language.
Stars: ✭ 35 (+9.38%)
Mutual labels:  dart-library
Alice
Painless middleware chaining for Go
Stars: ✭ 2,438 (+7518.75%)
Mutual labels:  handler
Middleware
Community Middleware List for the Iris Web Framework.
Stars: ✭ 188 (+487.5%)
Mutual labels:  handler
defense
🔮 A Crystal HTTP handler for throttling, blocking and tracking malicious requests.
Stars: ✭ 51 (+59.38%)
Mutual labels:  handler
text-style-editor
Text style editor widget for flutter
Stars: ✭ 25 (-21.87%)
Mutual labels:  dart-package
Xcrash
🔥 xCrash provides the Android app with the ability to capture java crash, native crash and ANR. No root permission or any system permissions are required.
Stars: ✭ 2,689 (+8303.13%)
Mutual labels:  handler

Queen Palace 🏰👑

Introduction

server side dart micro-framework to handle incoming http requests

hello world app

Future<void> main(List<String> args) async {
  final palace = Palace();
  palace.get('/greet_the_queen', (req, res) => res.send('Long Live The Queen 👑'));
  await palace.openGates();
}

hello world with decoration

decoration will help you split your code to parts or modules easily making the application easy to maintain

void main(List<String> args) async {
  final palace = Palace();
  palace.controllers([MainController()]);
  await palace.openGates();
}

class MainController extends PalaceController {
  MainController() : super('/');

  @Get()
  void greeTheQueen(Request req, Response res) {
    return res.send('Long Live The Queen 👑');
  }
}

Core Parts

Palace class

  • register routes and the call back for each route
  • use guards 'palace.use(CORSGuard())' for example
  • open the server
  • close the server

Request class

wrapper class around dart:io HttpRequest with extra functions and getters to make your life easier.

Response class

wrapper class around dart:io HttpResponse with extra functions and getters also to make the same life easier .

some of these functions are

  • res.json(data?) will convert the given data to JSON and sent it back to the user
  • res.file(path) give it path and it will give the file to the user
  • res.notFound(data?) => 404
  • res.internalServerError(data?) => 500
  • res.accepted(data?) => 200
  • res.created(data?) => 201

and so on....

Middleware aka Guard 💂‍♂️

a simple function

  • return void
  • takes any parameters you want starting from 0 parameters or the entire parameters list (see the parameters list down below)
  • guards considered as extra layer before the Handlers layers
  • they can be registered for specific route or as global guard for any kind of requests
  • they can response to incoming requests since they have access to the incoming request
  • they can preform any kind of logic before or after the handler be triggered

PalaceException class

you can throw them from any where from your application so guards can and handlers can or even the services can throw them

but what will happened then ? the palace will catch the exception format it to json including the given data object - if one was provided - and end the request life cycle

  • here some of them
  • BadRequest(data?)
  • NotFound(data?)
  • Unauthorized(data?)

Callback Parameters

if you are using the decoration you can get extra push to your endpoint callback or the guards you can extract these type of data from the incoming request

  • without decorations you can get access to the incoming request or the response by declaring the type of them
  @Get()
  void sayHi(Request req,Response Res) {
    //logic
    }

need to aces the request body directly and strong typed ? use @Body() decorator

class SignUpBody{
  late String name;
  late String email;
  late String password;
}
  @Post()
  void signUp(Request req,Response Res,@Body() SignUpBody body) {
    //logic
    }

need to access specific value from the body ?

@Body('key') String email

the same goes for

@Query()
@QueryParam()
@Param()

if you are building a guard use

@Next()

to get access to the next callback

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].