Skip to content

Getting started

Azuwey edited this page Feb 28, 2018 · 3 revisions

First of all you have to install the package

Installation with yarn

$ yarn add quartzfw

Installation with npm (not recommended)

$ npm install quartzfw --save-prod

Next step, you have to make a server

This is our express host. @ServerDecorator

import { ServerDecorator } from 'quartzfw';

import Application from './application.module';

@ServerDecorator({
	application: Application,
})
export default class Server {}

Then we have to make our application module.

This is our express application, here you can access the express application with the @AppDecorator //TODO: LINK TO MODULE DECORATOR

import { ModuleDecorator } from 'quartzfw';

import IndexController from './controllers/index.controller';

@ModuleDecorator({
	controllers: [ IndexController ],
})
export default class ApplicationModule {}

Then we have to make our controller

This is our controller, this handles our endpoints. //TODO: LINK TO CONTROLLER DECORATOR

import { Request, Response } from 'express';
import { ControllerDecorator, GetDecorator } from 'quartzfw';

@ControllerDecorator()
export default class IndexController {
	@GetDecorator()
	private test(req: Request, res: Response) {
		res.send('Hello from QuartzFW')
	}
}