Socket
Socket
Sign inDemoInstall

@foal/core

Package Overview
Dependencies
65
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @foal/core

*This work is in progress.*


Version published
Maintainers
1
Install size
1.69 MB
Created

Readme

Source

FoalTS

This work is in progress.

Installation

npm install --save express body-parser @foal/core

Get started

// tsconfig.json
{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "es6",
      "dom"
    ]
    ...
}
import * as bodyParser from 'body-parser';
import * as express from 'express';
import { FoalModule, Injectable, newExpressDecorator, rest, RestController, RestParams } from '@foal/core';

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

  async create(data: any, params: RestParams) {
    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: [
    newExpressDecorator(bodyParser.urlencoded({ extended: false })),
    newExpressDecorator(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

Keywords

FAQs

Last updated on 23 Sep 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc