dart_express 0.5.3 copy "dart_express: ^0.5.3" to clipboard
dart_express: ^0.5.3 copied to clipboard

An unopinionated express-like HTTP framework built in Dart, includes the ability to render Mustache, Jael and HTML files, and simple routing.

example/dart_express_example.dart

import 'package:dart_express/dart_express.dart';
import 'package:path/path.dart' as path;
import './api_routes.dart';
import './view_routes.dart';

const int PORT = 5000;

void main() {
  final app = express();

  app.use(BodyParser.json());
  app.use(CorsMiddleware.use());
  app.use(LoggerMiddleware.use(includeImmediate: true));

  app.engine(MarkdownEngine.use());
  app.engine(MustacheEngine.use());
  app.engine(JaelEngine.use());

  app.set('print routes', true);
  app.set('views', path.join(path.current, 'example/views'));
  app.set('view engine', 'mustache');

  app.useRouter('/api/', apiRouter());
  app.useRouter('/', viewRouter());

  app.listen(port: PORT, cb: (int port) => print('Listening on port $port'));
}
16
likes
40
points
56
downloads

Publisher

unverified uploader

Weekly Downloads

An unopinionated express-like HTTP framework built in Dart, includes the ability to render Mustache, Jael and HTML files, and simple routing.

Repository (GitHub)
View/report issues

License

BSD-2-Clause (license)

Dependencies

code_buffer, file, http, jael, jael_preprocessor, markdown, meta, mustache4dart, path, path_to_regexp, symbol_table

More

Packages that depend on dart_express