palace library

Classes

EndPoint
every request must have a endpoint ready to handle it else the palace will respond with res.notFoundHandler() 404 each endpoint has its own method
HttpStatus
HTTP status codes. Exported in dart:io and dart:html.
Logger
LogsGuard
Palace
PublicFilesGuard
Request
  • contains simplified logic to extract data from the io req class
  • Response
  • contains getters and logic to respond to incoming req
  • Typedefs

    Handler = FutureOr<void> Function(Request req, Response res)

    Exceptions / Errors

    BadRequest
    Forbidden
    NotAcceptable
    NotFound
    PalaceException
    for some cases you don't have access to Response instance like validation functionally or building authorization servers you may not have access to to the res instance so for more readable and cleaner code you can response with this exceptions you can throw BadRequest(data?) or NotFound or Unauthorized and palace will ! end the request lifecycle ? response to the request based on your exception so if you throw NotFound() the palace will make the response with code 404 and if you add data to the exception it will be included in the to the response body
    RequestTimeout
    Unauthorized