Giter Site home page Giter Site logo

dar's Introduction

This project is unmaintained, take a look at the successor SentiumJS!

This project is currently experimental and may not work properly! If you find any bug, please write an issue.

DAR
DAR

A TypeScript Decorator based API router for Deno.

Made for Deno Licence MIT Latest version Latest commit Status WIP

Key FeaturesIntroductionHow To UseExampleCreditsLicense

Key Features

  • Typescript with Decorators
  • Made for Deno
  • Lightweight
  • Zero third party dependencies (only std & my own modules (x/vade))
  • Highly customizable
  • Controller nesting (using @Include())
  • Native URLPattern routing

Introduction

DAR (formerly Pterosaur) stands for "Decorator based API Router" and is aimed to be used as a REST API Server, which primarily uses JSON data. It is built to support Deno Deploy.

How To Use

DAR is available via Deno's Thrid Party Modules.

import { ... } from 'https://deno.land/x/dar/mod.ts';

Create a simple controller class.

@Controller()
class SomeClass {
    // Methods here
}

Create a simple get method.

@Get()
someMethod() {
    return { success: true }
}

Create the application

const app: Application = new Application({
    controller: [SomeClass],
});

And register the handler. We use Deno's Standard Library

await serve((request: Request) => app.handle(request), { port: 8080 });

And all together

import { ... } from 'https://deno.land/x/dar/mod.ts';

@Controller()
class SomeClass {
    @Get()
    someMethod() {
        return { success: true }
    }
}

const app: Application = new Application({
    controller: [SomeClass],
});

await serve((request: Request) => app.handle(request), { port: 8080 });

Run the example

$ deno run --allow-net https://deno.land/x/dar/examples/basic.ts

Known issues

  • Include decorator not working in Deno Deploy. Need to use controller options to nest controllers!

You may also like...

  • Alosaur - Another decorator based router

Credits

This software uses the following open source projects:

License

MIT


Homepage luke.id  ·  GitHub @lkwr  ·  Twitter @wlkrlk

dar's People

Contributors

lkwr avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.