Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// License text available at https://opensource.org/licenses/MIT
import {BootMixin, BootOptions} from '@loopback/boot';
import {ApplicationConfig} from '@loopback/core';
import {RepositoryMixin} from '@loopback/repository';
import {RestApplication} from '@loopback/rest';
import {
Client,
createRestAppClient,
givenHttpServerConfig,
} from '@loopback/testlab';
import path from 'path';
import {Lb3AppBooterComponent} from '../lb3app.booter.component';
const lb3app = require('../../fixtures/lb3app/server/server');
export class CoffeeApplication extends BootMixin(
RepositoryMixin(RestApplication),
) {
constructor(options: ApplicationConfig = {}) {
super(options);
this.projectRoot = path.resolve(__dirname + '/..');
}
}
export async function setupApplication(
booterOptions?: BootOptions,
): Promise {
const app = new CoffeeApplication({rest: givenHttpServerConfig()});
app.component(Lb3AppBooterComponent);
app.bootOptions = Object.assign({}, booterOptions);
import {ApplicationConfig} from '@loopback/core';
import {RestApplication} from '@loopback/rest';
/* tslint:disable:no-unused-variable */
import {
DataSourceConstructor,
juggler,
RepositoryMixin,
Class,
Repository,
} from '@loopback/repository';
/* tslint:disable:no-unused-variable */
import {BootMixin, Booter, Binding} from '@loopback/boot';
import {dataSource} from './datasources';
export class TranscationMicroservice extends BootMixin(
RepositoryMixin(RestApplication),
) {
public _startTime: Date;
constructor(options?: ApplicationConfig) {
options = Object.assign(
{},
{
rest: {
port: 3003,
},
},
options,
);
super(options);
// Copyright IBM Corp. 2019. All Rights Reserved.
// Node module: @loopback/example-express-composition
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
import {BootMixin} from '@loopback/boot';
import {ApplicationConfig} from '@loopback/core';
import {RepositoryMixin} from '@loopback/repository';
import {RestApplication} from '@loopback/rest';
import {RestExplorerComponent} from '@loopback/rest-explorer';
import {ServiceMixin} from '@loopback/service-proxy';
import path from 'path';
import {MySequence} from './sequence';
export class NoteApplication extends BootMixin(
ServiceMixin(RepositoryMixin(RestApplication)),
) {
constructor(options: ApplicationConfig = {}) {
super(options);
// Set up the custom sequence
this.sequence(MySequence);
// Set up default home page
this.static('/', path.join(__dirname, '../public'));
this.component(RestExplorerComponent);
this.projectRoot = __dirname;
// Customize @loopback/boot Booter Conventions here
this.bootOptions = {
// Copyright IBM Corp. 2018,2019. All Rights Reserved.
// Node module: @loopback/example-soap-calculator
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
import {BootMixin} from '@loopback/boot';
import {ApplicationConfig} from '@loopback/core';
import {RepositoryMixin} from '@loopback/repository';
import {RestApplication} from '@loopback/rest';
import {RestExplorerComponent} from '@loopback/rest-explorer';
import {ServiceMixin} from '@loopback/service-proxy';
import path from 'path';
import {MySequence} from './sequence';
export class SoapCalculatorApplication extends BootMixin(
ServiceMixin(RepositoryMixin(RestApplication)),
) {
constructor(options: ApplicationConfig = {}) {
super(options);
// Set up the custom sequence
this.sequence(MySequence);
// Set up default home page
this.static('/', path.join(__dirname, '../public'));
this.component(RestExplorerComponent);
this.projectRoot = __dirname;
// Customize @loopback/boot Booter Conventions here
this.bootOptions = {
import {RepositoryMixin} from '@loopback/repository';
import {RestApplication} from '@loopback/rest';
import {ServiceMixin} from '@loopback/service-proxy';
import * as path from 'path';
import {MySequence} from './sequence';
//add
import {MyAuthBindings,
JWTService,
JWTStrategy,
UserPermissionsProvider,
} from './authorization';
import {AuthenticationComponent,
registerAuthenticationStrategy,
} from '@loopback/authentication';
export class FirstgameApplication extends BootMixin(
ServiceMixin(RepositoryMixin(RestApplication)),
) {
constructor(options: ApplicationConfig = {}) {
super(options);
//add
// Bind authentication component related elements
this.component(AuthenticationComponent);
// Bind JWT & permission authentication strategy related elements
registerAuthenticationStrategy(this, JWTStrategy);
this.bind(MyAuthBindings.TOKEN_SERVICE).toClass(JWTService);
this.bind(MyAuthBindings.USER_PERMISSIONS).toProvider(UserPermissionsProvider);
// Set up the custom sequence
this.sequence(MySequence);
// Set up default home page
// Copyright IBM Corp. 2018,2019. All Rights Reserved.
// Node module: @loopback/example-todo-list
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
import {BootMixin} from '@loopback/boot';
import {ApplicationConfig} from '@loopback/core';
import {RepositoryMixin} from '@loopback/repository';
import {RestApplication} from '@loopback/rest';
import {RestExplorerComponent} from '@loopback/rest-explorer';
import path from 'path';
import {MySequence} from './sequence';
export class TodoListApplication extends BootMixin(
RepositoryMixin(RestApplication),
) {
constructor(options: ApplicationConfig = {}) {
super(options);
// Set up the custom sequence
this.sequence(MySequence);
// Set up default home page
this.static('/', path.join(__dirname, '../public'));
this.component(RestExplorerComponent);
this.projectRoot = __dirname;
// Customize @loopback/boot Booter Conventions here
this.bootOptions = {
// Copyright IBM Corp. 2017,2018. All Rights Reserved.
// Node module: @loopback/example-lb3models
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
import {BootMixin} from '@loopback/boot';
import {ApplicationConfig} from '@loopback/core';
import {RestApplication} from '@loopback/rest';
import {RestExplorerComponent} from '@loopback/rest-explorer';
import {CompatMixin} from '@loopback/v3compat';
import * as path from 'path';
import {MySequence} from './sequence';
export class TodoListApplication extends CompatMixin(
BootMixin(RestApplication),
) {
constructor(options: ApplicationConfig = {}) {
super(options);
// Set up the custom sequence
this.sequence(MySequence);
// Set up default home page
this.static('/', path.join(__dirname, '../../public'));
this.component(RestExplorerComponent);
this.projectRoot = __dirname;
// Customize @loopback/boot Booter Conventions here
this.bootOptions = {
controllers: {
import {ApplicationConfig} from '@loopback/core';
import {RestApplication} from '@loopback/rest';
/* tslint:disable:no-unused-variable */
import {
DataSourceConstructor,
juggler,
RepositoryMixin,
Class,
Repository,
} from '@loopback/repository';
/* tslint:disable:no-unused-variable */
import {BootMixin, Booter, Binding} from '@loopback/boot';
import {dataSource} from './datasources/memory.datasource';
export class AccountMicroservice extends BootMixin(
RepositoryMixin(RestApplication),
) {
public _startTime: Date;
constructor(options?: ApplicationConfig) {
options = Object.assign(
{},
{
rest: {
port: 3001,
},
},
options,
);
super(options);
// License text available at https://opensource.org/licenses/MIT
import {ApplicationConfig} from '@loopback/core';
import {RestApplication} from '@loopback/rest';
/* tslint:disable:no-unused-variable */
import {
DataSourceConstructor,
juggler,
RepositoryMixin,
Class,
Repository,
} from '@loopback/repository';
/* tslint:disable:no-unused-variable */
import {BootMixin, Booter, Binding} from '@loopback/boot';
export class FacadeMicroservice extends BootMixin(
RepositoryMixin(RestApplication),
) {
public _startTime: Date;
constructor(options?: ApplicationConfig) {
options = Object.assign(
{},
{
rest: {
port: 3101,
},
},
options,
);
super(options);
import {createEnforcer} from './services/enforcer';
import {CasbinAuthorizationProvider} from './services/authorizor';
/**
* Information from package.json
*/
export interface PackageInfo {
name: string;
version: string;
description: string;
}
export const PackageKey = BindingKey.create('application.package');
const pkg: PackageInfo = require('../package.json');
export class ShoppingApplication extends BootMixin(
ServiceMixin(RepositoryMixin(RestApplication)),
) {
constructor(options?: ApplicationConfig) {
super(options);
/*
This is a workaround until an extension point is introduced
allowing extensions to contribute to the OpenAPI specification
dynamically.
*/
this.api({
openapi: '3.0.0',
info: {title: pkg.name, version: pkg.version},
paths: {},
components: {securitySchemes: SECURITY_SCHEME_SPEC},
servers: [{url: '/'}],