This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function workerFunction() { | |
this.addEventListener('message', (e) => { | |
console.log('log2: ', e); | |
fetchUrl(e.data); | |
}) | |
const fetchUrl = (url) => { | |
fetch(url) | |
.then((response) => { | |
console.log(response); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "sqlite", | |
"username": "test", | |
"password": "test", | |
"database": "./data/games.db", | |
"synchronize": true, | |
"logging": true, | |
"entities": [ | |
"src/entity/**/*.ts" | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { CreateGame } from './' | |
import ICommandConfig from '../../../common/ICommandConfig' | |
export class CRUDCommandFactory implements ICommandFactory { | |
makeCommand = (config:ICommandConfig) => { | |
if (config.commandName == CreateGame.name) { | |
return new CreateGame(config.args) | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { POSTCommand } from './POSTGameCommand' | |
import ICommandConfig from '../../../common/ICommandConfig' | |
export class GameCommandFactory implements ICommandFactory { | |
makeCommand = (config:ICommandConfig) => { | |
if (config.commandName == POSTCommand.name) { | |
return new POSTCommand(config.args) | |
} else { | |
throw new Error('Command not found!') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as express from "express"; | |
import gamesRouter from './routes/games' | |
const morgan = require('morgan') | |
import {createConnection} from "typeorm"; | |
const app = express(); | |
app.use(morgan('tiny')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Entity, PrimaryGeneratedColumn, Column} from "typeorm"; | |
@Entity() | |
export class Games { | |
@PrimaryGeneratedColumn() | |
id: number; | |
@Column({ nullable: true }) | |
Name: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Games } from "../../../entity/Games"; | |
import { getManager } from "typeorm"; | |
export class CreateGame implements ICommand { | |
private game:Games; | |
constructor(game:Games) { | |
this.game = game | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Games } from "../../../entity/Games"; | |
import * as DomainGameCommands from '../../domain/games'; | |
export class POSTCommand implements ICommand { | |
private game:Games; | |
constructor(game:Games) { | |
this.game = game | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
var gamesRouter = express.Router() | |
import * as AppGameCommands from '../commands/application/games' | |
import { Games } from "../entity/Games"; | |
const gameCommandFactory = new AppGameCommands.GameCommandFactory() | |
gamesRouter.post('/create', (req, res, next) => { |
NewerOlder