JSPM

  • Created
  • Published
  • Downloads 2075
  • Score
    100M100P100Q120329F
  • License MIT

Package Exports

  • @foal/core

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@foal/core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

FoalTS

This work is in progress.

Installation

npm install --save @foal/core

Get started

import * as bodyParser from 'body-parser';
import * as express from 'express';
import { FoalModule, Injectable, newExpressDecorateur, rest, RestController } from '@foal/core';

@Injectable()
class User implements RestController {
  constructor () {}

  async create(id, data, params) {
    console.log(params.query);
    data.createdAt = Date.now();
    return data;
  }
}

const app = express();
const foal = new FoalModule({
  services: [ User ],
  controllerBindings: [ rest.bindController('/users', User) ],
  sharedControllerDecorators: [
    newExpressDecorateur(bodyParser.urlencoded({ extended: false }),
    newExpressDecorateur(bodyParser.json())
  ]
});
app.use(foal.expressRouter());
app.listen(3000, () => console.log('Listening...'));

Documentation

Find docs here.

Contributing

There are several ways to contribute.

  • Submit a PR to fix typos/grammatical errors.
  • Open an issue to report a bug.
  • Open an issue to suggest a new feature.
  • Improve the docs.

Packages

License

MIT