notFound method

HttpResponse notFound()

Implementation

HttpResponse notFound() {

  final engine = App().container.make<TemplateEngine>();

  try {
    final html = engine.render("errors.404");
    response.headers.contentType = ContentType.html;
    return response
      ..statusCode = HttpStatus.notFound
      ..write(html)
      ..close();
  } catch(e) {
    return response
      ..statusCode = HttpStatus.notFound
      ..write("404 Not Found")
      ..close();

  }

}