# molti

> Extendable web framework

Latest version **1.3.4** (published 2017-08-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install molti
pnpm add molti
yarn add molti
bun add molti
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.4 |
| Published | 2017-08-26 |
| First published | 2017-06-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=7.9 |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | snapple750 |

## Links

- npm: https://www.npmjs.com/package/molti
- Repository: https://github.com/moltijs/molti
- Homepage: https://github.com/moltijs/molti#readme
- Issues: https://github.com/moltijs/molti/issues
- npm.io page: https://npm.io/package/molti

## Dependencies (7)

- [ajv](https://npm.io/package/ajv.md) ^5.1.5
- [knex](https://npm.io/package/knex.md) ^0.13.0
- [ramda](https://npm.io/package/ramda.md) ^0.24.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [express](https://npm.io/package/express.md) ^4.15.3
- [pluralize](https://npm.io/package/pluralize.md) ^6.0.0
- [body-parser](https://npm.io/package/body-parser.md) ^1.17.2

## Recent versions

- 1.3.4 (latest) — 2017-08-26
- 1.3.3 — 2017-08-26
- 1.3.2 — 2017-08-24
- 1.3.1 — 2017-08-24
- 1.3.0 — 2017-08-23
- 1.2.6 — 2017-08-21
- 1.2.5 — 2017-08-18
- 1.2.4 — 2017-08-17
- 1.2.3 — 2017-08-17
- 1.2.2 — 2017-08-10
- 1.2.1 — 2017-08-01
- 1.2.0 — 2017-08-01
- 1.1.6 — 2017-07-28
- 1.1.5 — 2017-07-28
- 1.1.4 — 2017-07-25
- … 31 more at https://npm.io/package/molti/versions

## README

[![NPM Version](https://img.shields.io/npm/v/molti.svg)](https://www.npmjs.com/package/molti)
[![NPM Downloads](https://img.shields.io/npm/dm/molti.svg)](https://www.npmjs.com/package/molti)
[![Gemnasium](https://img.shields.io/gemnasium/moltijs/molti.svg)](https://gemnasium.com/github.com/moltijs/molti)

[![Coveralls branch](https://img.shields.io/coveralls/moltijs/molti/master.svg)](https://coveralls.io/github/moltijs/molti)[![Travis branch](https://img.shields.io/travis/moltijs/molti/master.svg?label=linux)](https://travis-ci.org/moltijs/molti)
[![AppVeyor branch](https://img.shields.io/appveyor/ci/SaaJoh0783/molti/master.svg?label=windows)](https://ci.appveyor.com/project/moltijs/molti)

# Molti

A self documenting extensible framework powered by `express` and `knex`

### More documentation coming!

## Installation

```bash
$ npm install molti
```

## Basic Usage

#### As a server

```js
const { Parameter, Response, Application, Handler, Controller, Generics } = require('molti');

const sampleController = new Controller({
  basePath: '/'
});

sampleController.get(new Handler({
  path: '/some_path/:id',
  params: [Generics.params.id],
  responses: [Generics.responses.success],
  handler({ id }, { success }) {
    return success({ message: `Found ${id}` });
  }
}));

const sample = new Application({
  controllers: [sampleController]
});

sample.listen(3000);
```

#### As an ORM

```js
const { Schema, ModelFactory, Registry } = require('molti');

const parentSchema = new Schema({
  name: {
    type: Schema.Types.String
  },
  children: {
    type: Schema.Types.Models
  }
});

class Parent extends ModelFactory(parentSchema) {
  feedChildren() {
    return this.children.map(child => child.eat());
  }
}

const childSchema = new Schema({
  name: {
    type: Schema.Types.String
  },
  parent: {
    type: Schema.Types.Model
  }
});

class Child extends ModelFactory(childSchema) {
  eat() {
    return `I, ${this.name}, ate ${this.parent.name}'s food`;
  }
}

const registry = new Registry({
  client: 'sqlite',
  connection: {
    filename: ':memory:'
  }
}, [
  Child,
  Parent
]);

Parent.findById(1, { withRelated: ['children'] })
  .then(parent => console.log(parent.feedChildren()));
```

---
_Source: https://npm.io/package/molti · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
