All Projects → Jaguar-dart → Jaguar

Jaguar-dart / Jaguar

Licence: bsd-3-clause
Jaguar, a server framework built for speed, simplicity and extensible. ORM, Session, Authentication & Authorization, OAuth

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to Jaguar

Cerberus
A demonstration of a completely stateless and RESTful token-based authorization system using JSON Web Tokens (JWT) and Spring Security.
Stars: ✭ 482 (+68.53%)
Mutual labels:  rest-api, rest, authentication, authorization
Pode
Pode is a Cross-Platform PowerShell web framework for creating REST APIs, Web Sites, and TCP/SMTP servers
Stars: ✭ 329 (+15.03%)
Mutual labels:  rest, authentication, session, webserver
Watsonwebserver
Watson is the fastest, easiest way to build scalable RESTful web servers and services in C#.
Stars: ✭ 125 (-56.29%)
Mutual labels:  rest-api, rest, restful
Sandman2
Automatically generate a RESTful API service for your legacy database. No code required!
Stars: ✭ 1,765 (+517.13%)
Mutual labels:  rest-api, rest, orm
Http Fake Backend
Build a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 253 (-11.54%)
Mutual labels:  rest-api, rest, restful
Http restful api
整理HTTP后台端的RESTful API方面的知识
Stars: ✭ 94 (-67.13%)
Mutual labels:  rest-api, rest, restful
Node Typescript Mongodb
node js typescript mongodb express generator yo
Stars: ✭ 96 (-66.43%)
Mutual labels:  rest-api, rest, restful
Ssm
👅基于RESTful风格的前后端分离的SSM框架,集成了shiro和swagger等框架
Stars: ✭ 141 (-50.7%)
Mutual labels:  rest-api, rest, restful
Api Strategy
Equinor API Strategy
Stars: ✭ 56 (-80.42%)
Mutual labels:  rest-api, rest, restful
Koa Restful Boilerplate
Koa 2 RESTful API boilerplate
Stars: ✭ 146 (-48.95%)
Mutual labels:  rest-api, rest, restful
Node Express Mongoose Passport Jwt Rest Api Auth
Node, express, mongoose, passport and JWT REST API authentication example
Stars: ✭ 146 (-48.95%)
Mutual labels:  rest-api, rest, restful
Jda
Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Stars: ✭ 2,598 (+808.39%)
Mutual labels:  rest-api, rest, websocket
Ngx Api Utils
ngx-api-utils is a lean library of utilities and helpers to quickly integrate any HTTP API (REST, Ajax, and any other) with Angular.
Stars: ✭ 92 (-67.83%)
Mutual labels:  rest-api, rest, authentication
Evolutility Server Node
Model-driven REST or GraphQL backend for CRUD and more, written in Javascript, using Node.js, Express, and PostgreSQL.
Stars: ✭ 84 (-70.63%)
Mutual labels:  rest-api, rest, orm
Airdcpp Webclient
Communal peer-to-peer file sharing application for file servers/NAS devices
Stars: ✭ 106 (-62.94%)
Mutual labels:  rest-api, rest, websocket
Restfm
RESTful web services for FileMaker server.
Stars: ✭ 76 (-73.43%)
Mutual labels:  rest-api, rest, restful
Poloniex Api Node
Poloniex API client for REST and WebSocket API
Stars: ✭ 138 (-51.75%)
Mutual labels:  rest-api, rest, websocket
Blogbackendproject
Backend code for my blogs, develop with Django Rest framework.
Stars: ✭ 204 (-28.67%)
Mutual labels:  rest-api, rest, restful
Generator Http Fake Backend
Yeoman generator for building a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 49 (-82.87%)
Mutual labels:  rest-api, rest, restful
Calm
It is always Calm before a Tornado!
Stars: ✭ 50 (-82.52%)
Mutual labels:  rest-api, rest, restful

Pub Build Status Gitter

Jaguar

Jaguar is a full-stack production ready HTTP server framework built to be fast, simple and intuitive.

Getting started

Familiar way to write routes

Jaguar class provides methods get, put, post, delete and options to quickly add route handlers for specific HTTP methods.

main() async {
  final server = Jaguar();  // Serves the API at localhost:8080 by default
  // Add a route handler for 'GET' method at path '/hello'
  server.get('/hello', (Context ctx) => 'Hello world!');
  await server.serve();
}

Powerful route matching

Easily define and access Path parameters

Path segments prefixed with : can match any value and are also captured as path variables. Path variables can be accessed using pathParams member of Context object.

main(List<String> args) async {
  final quotes = <String>[
    'But man is not made for defeat. A man can be destroyed but not defeated.',
    'When you reach the end of your rope, tie a knot in it and hang on.',
    'Learning never exhausts the mind.',
  ];

  final server = Jaguar();
  server.get('/api/quote/:index', (ctx) { // The magic!
    final int index = ctx.pathParams.getInt('index', 1);  // The magic!
    return quotes[index + 1];
  });
  await server.serve();
}
  • A path can have multiple path variables.
  • A path variable can appear at any position in the path.
  • A path variable can be matched against a Regular expression.
  • getInt, getDouble, getNum and getBool methods can be used to easily typecast path variables.
  • Using * as the final path segment captures/matches all following segments.

Easily access Query parameters

Query parameters can be accessed using queryParams member of Context object.

main(List<String> args) async {
  final quotes = <String>[
    'But man is not made for defeat. A man can be destroyed but not defeated.',
    'When you reach the end of your rope, tie a knot in it and hang on.',
    'Learning never exhausts the mind.',
  ];

  final server = Jaguar();
  server.get('/api/quote', (ctx) {
    final int index = ctx.queryParams.getInt('index', 1); // The magic!
    return quotes[index + 1];
  });
  await server.serve();
}

getInt, getDouble, getNum and getBool methods can be used to easily typecast query parameters into desired type.

One liner to access Forms

A single line is all it takes to obtain a form as a Map<String, String> using method bodyAsUrlEncodedForm on Request object.

main(List<String> arguments) async {
  final server = Jaguar(port: 8005);

  server.postJson('/api/add', (ctx) async {
      final Map<String, String> map = await ctx.req.bodyAsUrlEncodedForm(); // The magic!
      contacts.add(Contact.create(map));
      return contacts.map((ct) => ct.toMap).toList();
    });


  await server.serve();
}

One liner to serve static files

The method staticFiles adds static files to Jaguar server. The first argument determines the request Uri that much be matched and the second argument determines the directory from which the target files are fetched.

main() async {
  final server = Jaguar();
  server.staticFiles('/static/*', 'static'); // The magic!
  await server.serve();
}

JSON serialization with little effort

Decoding JSON requests can't be simpler than using one of the built-in bodyAsJson, bodyAsJsonMap or bodyAsJsonList methods on Request object.

Future<void> main(List<String> args) async {
  final server = Jaguar();
  server.postJson('/api/book', (Context ctx) async {
    // Decode request body as JSON Map
    final Map<String, dynamic> json = await ctx.req.bodyAsJsonMap();
    Book book = Book.fromMap(json);
    return book; // Automatically encodes Book to JSON
  });

  await server.serve();
}

Out-of-the-box Sessions support

main() async {
  final server = Jaguar();
  server.get('/api/add/:item', (ctx) async {
    final Session session = await ctx.req.session;
    final String newItem = ctx.pathParams.item;

    final List<String> items = (session['items'] ?? '').split(',');

    // Add item to shopping cart stored on session
    if (!items.contains(newItem)) {
      items.add(newItem);
      session['items'] = items.join(',');
    }

    return Response.redirect('/');
  });
  server.get('/api/remove/:item', (ctx) async {
    final Session session = await ctx.req.session;
    final String newItem = ctx.pathParams.item;

    final List<String> items = (session['items'] ?? '').split(',');

    // Remove item from shopping cart stored on session
    if (items.contains(newItem)) {
      items.remove(newItem);
      session['items'] = items.join(',');
    }

    return Response.redirect('/');
  });
  await server.serve();
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].