Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

microframework

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microframework

Micro framework is a bundle of express.js, mongodb ODM, validator, dependancy injection framework and restful controllers for your apps using Typescript

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
451
decreased by-3.63%
Maintainers
1
Weekly downloads
 
Created
Source

MicroFramework

Micro framework is a bundle of express.js, Mongodb ODM, dependancy injection framework and restful controllers for your apps using Typescript.

Usage

Create your main application entry point app.ts and put there:

import {MicroFrameworkConfig} from "microframework/MicroFrameworkConfig";
import {MicroFrameworkRunner} from "microframework/MicroFrameworkRunner";

let configuration = {
    express: {
        bodyParser: "json"
    },
    odm: {
        driver: "mongodb",
        connection: {
            url: "mongodb://localhost:27017/microframework-samples"
        }
    }
}; // you can also store this configuration in separate json file and require it

new MicroFrameworkRunner(__dirname, configuration)
    .run()
    .then(result => console.log('Express app is running. Open localhost:3000/questions'))
    .catch(error => console.error('Error: ', error));

Now create your first controller in the controller/ directory. Lets call it QuestionController:

import {Controller, Get} from "type-controllers/Annotations";
import {Response} from "express";
import {Request} from "express";

@Controller()
export class QuestionController {

    @Get('/questions')
    all(request: Request, response: Response): any[] {
        return [
            { title: 'Which processor to choose?', text: 'Which processor is better: Core i5 or Core i7?' },
            { title: 'When new star wars gonna be released?', text: 'When star wars gonna be released? I heard in november' }
        ];
    }
}

Now run your app and open http://localhost:3000/questions in browser. You should see list of your questions. Take a look on samples in ./sample for more examples of usages.

Todos

  • cover with tests
  • more documentation and samples

FAQs

Package last updated on 05 Oct 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc