Alpha ready :)
This commit is contained in:
parent
acbe7d3738
commit
373a3a30c6
7 changed files with 101 additions and 33 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -7,6 +7,7 @@
|
||||||
.packages
|
.packages
|
||||||
.project
|
.project
|
||||||
.pub/
|
.pub/
|
||||||
|
.scripts-bin/
|
||||||
build/
|
build/
|
||||||
**/packages/
|
**/packages/
|
||||||
|
|
||||||
|
@ -73,4 +74,11 @@ crashlytics.properties
|
||||||
crashlytics-build.properties
|
crashlytics-build.properties
|
||||||
fabric.properties
|
fabric.properties
|
||||||
|
|
||||||
|
### VSCode template
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
|
||||||
logs/**/*.txt
|
logs/**/*.txt
|
15
.vscode/launch.json
vendored
Normal file
15
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Start Server",
|
||||||
|
"type": "dart-cli",
|
||||||
|
"request": "launch",
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"debugSettings": "${command.debugSettings}",
|
||||||
|
"program": "${workspaceRoot}/bin/server.dart",
|
||||||
|
"args": [],
|
||||||
|
"preLaunchTask": "pub:serve"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
25
.vscode/tasks.json
vendored
Normal file
25
.vscode/tasks.json
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "0.1.0",
|
||||||
|
"command": "pub",
|
||||||
|
"isShellCommand": true,
|
||||||
|
"echoCommand": true,
|
||||||
|
"showOutput": "always",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"taskName": "pub:build",
|
||||||
|
"suppressTaskName": true,
|
||||||
|
"args": [
|
||||||
|
"build"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"taskName": "pub:serve",
|
||||||
|
"suppressTaskName": true,
|
||||||
|
"args": [
|
||||||
|
"serve"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
library angel.routes;
|
library angel.routes;
|
||||||
|
|
||||||
import 'package:angel_cors/angel_cors.dart';
|
import 'package:angel_cors/angel_cors.dart';
|
||||||
|
import 'package:angel_errors/angel_errors.dart';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel_framework/angel_framework.dart';
|
||||||
import 'package:angel_proxy/angel_proxy.dart';
|
import 'package:angel_proxy/angel_proxy.dart';
|
||||||
import 'package:angel_static/angel_static.dart';
|
import 'package:angel_static/angel_static.dart';
|
||||||
|
@ -19,14 +20,32 @@ configureRoutes(Angel app) async {
|
||||||
}
|
}
|
||||||
|
|
||||||
configureAfter(Angel app) async {
|
configureAfter(Angel app) async {
|
||||||
// 404 handler
|
// Set our application up to handle different errors.
|
||||||
app.after.add((req, ResponseContext res) async {
|
var errors = new ErrorHandler(handlers: {
|
||||||
throw new AngelHttpException.NotFound();
|
404: (req, res) async =>
|
||||||
|
res.render('error', {'message': 'No file exists at ${req.path}.'}),
|
||||||
|
500: (req, res) async => res.render('error', {'message': req.error.message})
|
||||||
});
|
});
|
||||||
|
|
||||||
// Default error handler
|
errors.fatalErrorHandler = (AngelFatalError e) async {
|
||||||
app.onError(
|
e.request.response
|
||||||
(e, req, res) async => res.render('error', {'message': e.message}));
|
..statusCode = 500
|
||||||
|
..writeln('500 Internal Server Error: ${e.error}')
|
||||||
|
..writeln(e.stack);
|
||||||
|
await e.request.response.close();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Throw a 404 if no route matched the request
|
||||||
|
app.after.add(errors.throwError());
|
||||||
|
|
||||||
|
// Handle errors when they occur, based on outgoing status code.
|
||||||
|
// By default, requests will go through the 500 handler, unless
|
||||||
|
// they have an outgoing 200, or their status code has a handler
|
||||||
|
// registered.
|
||||||
|
app.after.add(errors.middleware());
|
||||||
|
|
||||||
|
// Pass AngelHttpExceptions through handler as well
|
||||||
|
await app.configure(errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
configureServer(Angel app) async {
|
configureServer(Angel app) async {
|
||||||
|
|
47
pubspec.yaml
47
pubspec.yaml
|
@ -1,26 +1,27 @@
|
||||||
name: angel
|
author: "Tobe O"
|
||||||
description: An easily-extensible web server framework in Dart.
|
description: "An easily-extensible web server framework in Dart."
|
||||||
version: 1.0.0-dev
|
homepage: "https://github.com/angel-dart/angel"
|
||||||
author: Tobe O
|
name: "angel"
|
||||||
homepage: https://github.com/angel-dart/angel
|
publish_to: "none"
|
||||||
publish_to: none
|
version: "1.0.0-dev"
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_auth: ^1.0.0-dev
|
angel_auth: "^1.0.0-dev"
|
||||||
angel_configuration: ^1.0.0-dev
|
angel_compress: "^1.0.0"
|
||||||
angel_cors: ^1.0.0-dev
|
angel_configuration: "^1.0.0-dev"
|
||||||
angel_diagnostics: ^1.0.0-dev
|
angel_cors: "^1.0.0-dev"
|
||||||
angel_errors: ^1.0.0-dev
|
angel_diagnostics: "^1.0.0-dev"
|
||||||
angel_framework: ^1.0.0-dev
|
angel_errors: "^1.0.0-dev"
|
||||||
angel_mongo: ^1.0.0-dev
|
angel_framework: "^1.0.0-dev"
|
||||||
angel_mustache: ^1.0.0-dev
|
angel_mongo: "^1.0.0-dev"
|
||||||
angel_proxy: ^1.0.0-dev
|
angel_mustache: "^1.0.0-dev"
|
||||||
angel_static: ^1.1.0-dev
|
angel_proxy: "^1.0.0-dev"
|
||||||
angel_test: ^1.0.0-dev
|
angel_static: "^1.1.0-dev"
|
||||||
mailer: ^1.1.0+4
|
angel_test: "^1.0.0-dev"
|
||||||
validate: ^1.5.2
|
mailer: "^1.1.0+4"
|
||||||
|
validate: "^1.5.2"
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
http: ^0.11.3
|
grinder: "^0.8.0+2"
|
||||||
grinder: ^0.8.0+2
|
http: "^0.11.3"
|
||||||
test: ^0.12.13
|
test: "^0.12.13"
|
||||||
transformers:
|
transformers:
|
||||||
- angel_configuration
|
- "angel_configuration"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{{message}}</title>
|
<title>Error</title>
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
|
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue