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
@Controller('api/users') | |
export class UserController { | |
@Get(':id') | |
@Middleware([middleware1, middleware2]) | |
get(req: Request, res: Response, next: NextFunction): any { | |
console.log(req.params.id); | |
return res.status(200).json({msg: 'get_called'}); | |
} | |
} |
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
export class UserController { | |
getRoutes(): Router { | |
let router = express.Router(); | |
router.get('/api/users/:id', [middleware1, middleware2], (req, res, next) => { | |
this.get(req, res, next); | |
} |
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 { Request, Response, NextFunction } from 'express' | |
import { Controller, Middleware, Get, Post, Put, Delete } from '@overnightjs/core' | |
@Controller('api/users') | |
export class UserController { | |
@Get(':id') | |
get(req: Request, res: Response): any { |
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 bodyParser from 'body-parser' | |
import { Server } from '@overnightjs/core' | |
import { UserController } from './UserController' | |
import { LoginController } from './LoginController' | |
export class SampleServer extends Server { | |
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
Show hidden characters
{ | |
"compileOnSave": false, | |
"compilerOptions": { | |
"noImplicitAny": true, <--- Add this option | |
"baseUrl": "./", | |
"outDir": "./dist/out-tsc", | |
"sourceMap": true, | |
"declaration": false, | |
"module": "es2015", | |
"moduleResolution": "node", |
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
// ******* Same Line ******* // | |
class Dog { | |
makeSound(breed: string): void { | |
if(breed === 'chihuahua') { | |
console.log('growl') | |
} else if(breed === 'beagle') { | |
console.log('woof woof') | |
} 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
class Dog | |
{ | |
makeSound(breed: string): void | |
{ | |
if(breed === 'chihuahua') { | |
console.log('growl') | |
} | |
else if(breed === 'beagle') { | |
console.log('woof woof') | |
} |
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 Dog = /** @class */ (function () { | |
function Dog() { | |
} | |
Dog.prototype.makeSound = function (breed) { | |
if (breed === 'chihuahua') { | |
console.log('growl'); | |
} | |
else if (breed === 'beagle') { | |
console.log('woof woof'); | |
} |
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
class Dog | |
{ | |
private _weight: number | |
static readonly SPECIES = 'canis familiaris' | |
static readonly TAXONOMY: Taxonomy = taxonomiesModule(this.SPECIES) | |
set weight(weight: number): void | |
{ | |
this._weight = weight | |
} |
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
/** | |
* TypeScript file for the "Dog" class | |
* | |
* created by sean maxwell Nov 1, 2018 | |
*/ | |
class Dog extends Animal | |
{ | |
furColor: string |
OlderNewer