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
Documentation can be found on here.
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))
- Leverages TypeScript decorators for a concise, intuitive application design
- Can be used with standard
express.js
plugins
$ npm install microdose
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
.
- Replace
path-to-regexp
with simpler custom alternative - Support URL queries (easy)
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.