miter

A typescript web framework based on ExpressJs based loosely on SailsJs

Usage no npm install needed!

<script type="module">
  import miter from 'https://cdn.skypack.dev/miter';
</script>

README

Build Status

Miter Web Framework

Miter is a web framework heavily influenced by Ruby on Rails and SailsJs. It is built on top of Express. Miter uses Typescript's experimental decorators to create elegant controllers and services, using dependency injection to avoid tight coupling.

Installation

Install miter using NPM.

npm install --save miter miter-cli

miter-cli is optional, but can be used to generate and run database migrations from the command line. See miter-framework/miter-cli for more details.

Example

First, create a controller:

import { Controller, Get } from 'miter';
import { Request, Response } from 'express';

@Controller()
class HelloWorldController {
    
    @Get('greet')
    async sampleRoute(req: Request, res: Response) {
        res.status(200).send(`Hello, World!`);
    }
    
}

Next, start the Miter server using Miter.launch:

import { Miter } from 'miter';
import { HelloWorldController } from './hello-world.controller.ts';

Miter.launch({
    name: 'server-name',
    port: 8080,
    router: {
        controllers: [HelloWorldController]
    }
});

After you have launched your server, navigate to localhost:8080/greet to see your route in action.

This is a simple demonstration, but you can already see how simple and easy it is to get a server up and running.

Contributing

Miter is a relatively young framework, and there are bound to be many ways that it can be improved. If you notice a bug, or would like to request a feature, feel free to create an issue. Better yet, you can fork the project and submit a pull request with the added feature.

Changelog

See what's new in recent versions of Miter.

Attribution

Special thanks to BrowserStack for generously hosting our cross-browser integration tests!

BrowserStack