Git Product home page Git Product logo

microdose's Introduction

microdose

A feather-light JavaScript API framework for Node, written in TypeScript, built for micro-services. This is the fastest Node.js framework on this planet. See the benchmark results here

codebeat badge npm version

Documentation

Documentation can be found on here.

Hello World

src/server.ts

import {
  uApp,
  uMethods,
  uRequest,
  uResponse,
  uRouter
} from 'microdose'

@uRouter()
class App {

  @uMethods.get()
  helloWorld (req: uRequest, res: uResponse) {
    res.send('Hello world!')
  }
}

const config = {
  port: 3000
}

uApp.bootstrap(App, config)
.then(() => console.log('\nListening on port:', config.port))

Features

  • Leverages TypeScript decorators for a concise, intuitive application design
  • Can be used with standard express.js plugins

Installation

$ npm install microdose

Playground

Clone the repo from https://github.com/borislemke/microdose.

Install dependencies

$ npm install

Run the example

$ npm start

Visit http://localhost:3000 to see Hello World.

Future

  • Replace path-to-regexp with simpler custom alternative
  • Support URL queries (easy)

Issues

Wildcard does not work on root router:

@uRouter({
  children: [UsersRoute],
  middleware: [
    bodyParser.json()
  ]
})
export class App {

  @uMethod.get()
  helloWorld (req: uRequest, res: uResponse) {
    res.send('Hello world!')
  }

  @uMethod.get('/*')
  notFound (req: uRequest, res: uResponse) {
    res.send('Any are you okay?')
  }
}

Visiting host:port/ will always return the /* handler first.

microdose's People

Contributors

borislemke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

microdose's Issues

All routes return 404 when using from npm

When starting the app from the repo, everything works fine. However, when creating a new project and using microdose by npm i and then import {} from 'microdose, any routes seem to return 404 ๐Ÿ˜…

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.