clear out boilerplate files/folders

This commit is contained in:
Tobe O 2020-02-15 17:59:23 -05:00
parent a6062cf7cc
commit 6f6510ab27
30 changed files with 0 additions and 557 deletions

View file

@ -1,10 +0,0 @@
.dart_tool
.idea
.pub
.vscode
logs/
test/
build/
.analysis-options
.packages
*.g.dart

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
<State>
<id>General</id>
</State>
<State>
<id>XPath</id>
</State>
</expanded-state>
<selected-state>
<State>
<id>AngularJS</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
</project>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/angel.iml" filepath="$PROJECT_DIR$/.idea/angel.iml" />
</modules>
</component>
</project>

View file

@ -1,8 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="dev.dart" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application" singleton="true" nameIsGenerated="true">
<option name="VMOptions" value="--observe" />
<option name="filePath" value="$PROJECT_DIR$/bin/dev.dart" />
<option name="workingDirectory" value="$PROJECT_DIR$" />
<method />
</configuration>
</component>

View file

@ -1,11 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="prod.dart" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application" singleton="true" nameIsGenerated="true">
<option name="checkedMode" value="false" />
<option name="envs">
<entry key="ANGEL_ENV" value="production" />
</option>
<option name="filePath" value="$PROJECT_DIR$/bin/prod.dart" />
<option name="workingDirectory" value="$PROJECT_DIR$" />
<method />
</configuration>
</component>

21
.vscode/launch.json vendored
View file

@ -1,21 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Development Server",
"type": "dart",
"request": "launch",
"program": "${workspaceRoot}/bin/dev.dart",
"vmAdditionalArgs": ["--observe"]
},
{
"name": "Production Server",
"type": "dart",
"request": "launch",
"program": "${workspaceRoot}/bin/prod.dart",
"env": {
"ANGEL_ENV": "production"
}
}
]
}

View file

@ -1,14 +0,0 @@
FROM google/dart:latest
COPY ./ ./
# Install dependencies, pre-build
RUN pub get
# Optionally build generaed sources.
# RUN pub run build_runner build
# Set environment, start server
ENV ANGEL_ENV=production
EXPOSE 3000
CMD dart bin/prod.dart

View file

@ -1,60 +0,0 @@
[![The Angel Framework](https://angel-dart.github.io/assets/images/logo.png)](https://angel-dart.dev)
[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/angel_dart/discussion)
[![Pub](https://img.shields.io/pub/v/angel_framework.svg)](https://pub.dartlang.org/packages/angel_framework)
[![Build status](https://travis-ci.org/angel-dart/framework.svg?branch=master)](https://travis-ci.org/angel-dart/framework)
![License](https://img.shields.io/github/license/angel-dart/framework.svg)
**A polished, production-ready backend framework in Dart.**
*Note: This repo is an application boilerplate ,and not the underlying framework library.*
-----
## About
Angel is a full-stack Web framework in Dart. It aims to
streamline development by providing many common features
out-of-the-box in a consistent manner.
With features like the following, Angel is the all-in-one framework you should choose to build your next project:
* [GraphQL Support](https://github.com/angel-dart/graphql)
* [PostgreSQL ORM](https://github.com/angel-dart/orm)
* [Dependency Injection](https://docs.angel-dart.dev/guides/dependency-injection)
* And [much more](https://github.com/angel-dart)...
## Installation & Setup
Once you have [Dart](https://www.dartlang.org/) installed, bootstrapping a project is as simple as running a few shell commands:
Install the [Angel CLI](https://github.com/angel-dart/cli):
```bash
pub global activate angel_cli
```
Bootstrap a project:
```bash
angel init hello
```
You can even have your server run and be *hot-reloaded* on file changes:
```bash
dart --observe bin/dev.dart
```
Next, check out the [detailed documentation](https://docs.angel-dart.dev/v/2.x) to learn to flesh out your project.
## Examples and Documentation
Visit the [documentation](https://docs.angel-dart.dev/v/2.x)
for dozens of guides and resources, including video tutorials,
to get up and running as quickly as possible with Angel.
Examples and complete projects can be found
[here](https://github.com/angel-dart/examples-v2).
You can also view the [API Documentation](http://www.dartdocs.org/documentation/angel_framework/latest).
There is also an [Awesome Angel :fire:](https://github.com/angel-dart/awesome-angel) list.

View file

@ -1,8 +0,0 @@
include: package:pedantic/analysis_options.yaml
analyzer:
strong-mode:
implicit-casts: false
linter:
rules:
- unnecessary_const
- unnecessary_new

View file

@ -1,28 +0,0 @@
import 'dart:io';
import 'package:angel/src/pretty_logging.dart';
import 'package:angel/angel.dart';
import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_hot/angel_hot.dart';
import 'package:logging/logging.dart';
main() async {
// Watch the config/ and web/ directories for changes, and hot-reload the server.
hierarchicalLoggingEnabled = true;
var hot = HotReloader(() async {
var logger = Logger.detached('{{angel}}')
..level = Level.ALL
..onRecord.listen(prettyLog);
var app = Angel(logger: logger, reflector: MirrorsReflector());
await app.configure(configureServer);
return app;
}, [
Directory('config'),
Directory('lib'),
]);
var server = await hot.startServer('127.0.0.1', 3000);
print(
'{{angel}} server listening at http://${server.address.address}:${server.port}');
}

View file

@ -1,30 +0,0 @@
import 'package:angel/angel.dart';
import 'package:angel_container/mirrors.dart';
import 'package:angel_production/angel_production.dart';
// NOTE: By default, the Runner class does not use the `MirrorsReflector`, or any
// reflector, by default.
//
// If your application is using any sort of functionality reliant on annotations or reflection,
// either include the MirrorsReflector, or use a static reflector variant.
//
// The following use cases require reflection:
// * Use of Controllers, via @Expose() or @ExposeWS()
// * Use of dependency injection into constructors, whether in controllers or plain `container.make` calls
// * Use of the `ioc` function in any route
//
// The `MirrorsReflector` from `package:angel_container/mirrors.dart` is by far the most convenient pattern,
// so use it if possible.
//
// However, the following alternatives exist:
// * Generation via `package:angel_container_generator`
// * Creating an instance of `StaticReflector`
// * Manually implementing the `Reflector` interface (cumbersome; not recommended)
//
// As of January 4th, 2018, the documentation has not yet been updated to state this,
// so in the meantime, visit the Angel chat for further questions:
//
// https://gitter.im/angel_dart/discussion
main(List<String> args) =>
Runner('{{angel}}', configureServer, reflector: MirrorsReflector())
.run(args);

View file

@ -1,5 +0,0 @@
# Default server configuration.
jwt_secret: INSECURE_DEFAULT_SECRET
host: 127.0.0.1
mongo_db: mongodb://localhost:27017/angel
port: 3000

View file

@ -1,2 +0,0 @@
# Development-only server configuration.
debug: true

View file

@ -1,3 +0,0 @@
# Production-only server configuration
debug: false
jwt_secret: INSECURE_DEFAULT_SECRET

View file

@ -1,21 +0,0 @@
/// Your very own web application!
library angel;
import 'dart:async';
import 'package:angel_framework/angel_framework.dart';
import 'package:file/local.dart';
import 'src/config/config.dart' as configuration;
import 'src/routes/routes.dart' as routes;
import 'src/services/services.dart' as services;
/// Configures the server instance.
Future configureServer(Angel app) async {
// Grab a handle to the file system, so that we can do things like
// serve static files.
var fs = const LocalFileSystem();
// Set up our application, using the plug-ins defined with this project.
await app.configure(configuration.configureServer(fs));
await app.configure(services.configureServer);
await app.configure(routes.configureServer(fs));
}

View file

@ -1,33 +0,0 @@
/// Configuration for this Angel instance.
library angel.src.config;
import 'package:angel_configuration/angel_configuration.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_jael/angel_jael.dart';
import 'package:file/file.dart';
import 'plugins/plugins.dart' as plugins;
/// This is a perfect place to include configuration and load plug-ins.
AngelConfigurer configureServer(FileSystem fileSystem) {
return (Angel app) async {
// Load configuration from the `config/` directory.
//
// See: https://github.com/angel-dart/configuration
await app.configure(configuration(fileSystem));
// Configure our application to render Jael templates from the `views/` directory.
//
// See: https://github.com/angel-dart/jael
await app.configure(jael(fileSystem.directory('views')));
// Apply another plug-ins, i.e. ones that *you* have written.
//
// Typically, the plugins in `lib/src/config/plugins/plugins.dart` are plug-ins
// that add functionality specific to your application.
//
// If you write a plug-in that you plan to use again, or are
// using one created by the community, include it in
// `lib/src/config/config.dart`.
await plugins.configureServer(app);
};
}

View file

@ -1,9 +0,0 @@
/// Custom plugins go here.
library angel.src.config.plugins;
import 'dart:async';
import 'package:angel_framework/angel_framework.dart';
Future configureServer(Angel app) async {
// Include any plugins you have made here.
}

View file

@ -1,38 +0,0 @@
import 'package:angel_http_exception/angel_http_exception.dart';
import 'package:logging/logging.dart';
import 'package:io/ansi.dart';
/// Prints the contents of a [LogRecord] with pretty colors.
void prettyLog(LogRecord record) {
var code = chooseLogColor(record.level);
if (record.error == null) print(code.wrap(record.toString()));
if (record.error != null) {
var err = record.error;
if (err is AngelHttpException && err.statusCode != 500) return;
print(code.wrap(record.toString() + '\n'));
print(code.wrap(err.toString()));
if (record.stackTrace != null) {
print(code.wrap(record.stackTrace.toString()));
}
}
}
/// Chooses a color based on the logger [level].
AnsiCode chooseLogColor(Level level) {
if (level == Level.SHOUT)
return backgroundRed;
else if (level == Level.SEVERE)
return red;
else if (level == Level.WARNING)
return yellow;
else if (level == Level.INFO)
return cyan;
else if (level == Level.CONFIG ||
level == Level.FINE ||
level == Level.FINER ||
level == Level.FINEST) return lightGray;
return resetAll;
}

View file

@ -1,8 +0,0 @@
library angel.src.routes.controllers;
import 'dart:async';
import 'package:angel_framework/angel_framework.dart';
Future configureServer(Angel app) async {
/// Controllers will not function unless wired to the application!
}

View file

@ -1,62 +0,0 @@
/// This app's route configuration.
library angel.src.routes;
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_static/angel_static.dart';
import 'package:file/file.dart';
import 'controllers/controllers.dart' as controllers;
/// Put your app routes here!
///
/// See the wiki for information about routing, requests, and responses:
/// * https://github.com/angel-dart/angel/wiki/Basic-Routing
/// * https://github.com/angel-dart/angel/wiki/Requests-&-Responses
AngelConfigurer configureServer(FileSystem fileSystem) {
return (Angel app) async {
// Typically, you want to mount controllers first, after any global middleware.
await app.configure(controllers.configureServer);
// Render `views/hello.jl` when a user visits the application root.
app.get('/', (req, res) => res.render('hello'));
// Mount static server at web in development.
// The `CachingVirtualDirectory` variant of `VirtualDirectory` also sends `Cache-Control` headers.
//
// In production, however, prefer serving static files through NGINX or a
// similar reverse proxy.
//
// Read the following two sources for documentation:
// * https://medium.com/the-angel-framework/serving-static-files-with-the-angel-framework-2ddc7a2b84ae
// * https://github.com/angel-dart/static
if (!app.environment.isProduction) {
var vDir = VirtualDirectory(
app,
fileSystem,
source: fileSystem.directory('web'),
);
app.fallback(vDir.handleRequest);
}
// Throw a 404 if no route matched the request.
app.fallback((req, res) => throw AngelHttpException.notFound());
// Set our application up to handle different errors.
//
// Read the following for documentation:
// * https://github.com/angel-dart/angel/wiki/Error-Handling
var oldErrorHandler = app.errorHandler;
app.errorHandler = (e, req, res) async {
if (req.accepts('text/html', strict: true)) {
if (e.statusCode == 404 && req.accepts('text/html', strict: true)) {
await res
.render('error', {'message': 'No file exists at ${req.uri}.'});
} else {
await res.render('error', {'message': e.message});
}
} else {
return await oldErrorHandler(e, req, res);
}
};
};
}

View file

@ -1,15 +0,0 @@
/// Declare services here!
library angel.services;
import 'dart:async';
import 'package:angel_framework/angel_framework.dart';
/// Configure our application to use *services*.
/// Services must be wired to the app via `app.use`.
///
/// They provide many benefits, such as instant REST API generation,
/// and respond to both REST and WebSockets.
///
/// Read more here:
/// https://github.com/angel-dart/angel/wiki/Service-Basics
Future configureServer(Angel app) async {}

View file

@ -1,20 +0,0 @@
name: angel
description: An app that's going to be amazing pretty soon.
publish_to: none # Ensure we don't accidentally publish our private code! ;)
environment:
sdk: '>=2.0.0-dev <3.0.0'
homepage: https://github.com/angel-dart/angel
dependencies:
angel_auth: ^2.0.0 # Supports stateless authentication via JWT
angel_configuration: ^2.0.0 # Loads application configuration, along with support for .env files.
angel_framework: ^2.0.0 # The core server library.
angel_jael: ^2.0.0 # Server-side templating engine
angel_production: ^1.0.0 # Production application runner.
angel_static: ^2.0.0 # Static file server
angel_validate: ^2.0.0 # Allows for validation of input data
dev_dependencies:
angel_hot: ^2.0.0 # Hot-reloading support. :)
angel_test: ^2.0.0 # Utilities for testing Angel servers.
io: ^0.3.2 # For pretty printing.
pedantic: ^1.0.0 # Enforces Dart style conventions.
test: ^1.0.0 # For unit testing.

View file

@ -1,43 +0,0 @@
import 'package:angel/angel.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_test/angel_test.dart';
import 'package:test/test.dart';
// Angel also includes facilities to make testing easier.
//
// `package:angel_test` ships a client that can test
// both plain HTTP and WebSockets.
//
// Tests do not require your server to actually be mounted on a port,
// so they will run faster than they would in other frameworks, where you
// would have to first bind a socket, and then account for network latency.
//
// See the documentation here:
// https://github.com/angel-dart/test
//
// If you are unfamiliar with Dart's advanced testing library, you can read up
// here:
// https://github.com/dart-lang/test
main() async {
TestClient client;
setUp(() async {
var app = Angel();
await app.configure(configureServer);
client = await connectTo(app);
});
tearDown(() async {
await client.close();
});
test('index returns 200', () async {
// Request a resource at the given path.
var response = await client.get('/');
// Expect a 200 response.
expect(response, hasStatus(200));
});
}

View file

@ -1,5 +0,0 @@
<extend src="layout.jael">
<block name="content">
<div class="title">{{ message }}</div>
</block>
</extend>

View file

@ -1,5 +0,0 @@
<extend src="layout.jael">
<block name="content">
<div class="title">Angel</div>
</block>
</extend>

View file

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ title ?? 'Angel' }}</title>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/css/site.css">
<link rel="icon" href="/images/favicon.png">
</head>
<body>
<div class="container">
<div class="content">
<block name="content"></block>
</div>
</div>
</body>
</html>

View file

@ -1,27 +0,0 @@
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
width: 100%;
display: table;
font-weight: 100;
font-family: 'Lato', sans-serif;
}
.container {
text-align: center;
display: table-cell;
vertical-align: middle;
}
.content {
text-align: center;
display: inline-block;
}
.title {
font-size: 96px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -1,2 +0,0 @@
User-agent: *
Disallow: /admin