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
{ | |
"name": "expresstypescript", | |
"version": "1.0.0", | |
"description": "Develop and ExpressJS webserver using TypeScript", | |
"main": "build/start.js", | |
"scripts": { | |
"test": "none", | |
"start-dev": "nodemon --config \"./util/nodemon.json\"/", | |
"build": "rm -rf ./build/ && tsc", | |
"start": "node build/start.js" |
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 ExampleServer from './ExampleServer'; | |
const exampleServer = new ExampleServer(); | |
exampleServer.start(3000); |
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 * as controllers from './controllers'; | |
import { Server } from '@overnightjs/core'; | |
import { Logger } from '@overnightjs/logger'; | |
class ExampleServer extends Server { | |
private readonly SERVER_STARTED = 'Example server started on port: '; | |
constructor() { |
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 } from 'express'; | |
import { Controller, Middleware, Get, Put, Post, Delete } from '@overnightjs/core'; | |
import { Logger } from '@overnightjs/logger'; | |
@Controller('api') | |
export class ExampleController { | |
@Get(':msg') | |
private getMessage(req: Request, res: Response) { | |
Logger.Info(req.params.msg); |
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
{ | |
"name": "expresstypescript", | |
"version": "1.0.0", | |
"description": "Develop and ExpressJS webserver using TypeScript", | |
"main": "build/start.js", | |
"scripts": { | |
"test": "none", | |
"start-dev": "nodemon --config \"./util/nodemon.json\"/", |
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
{ | |
"watch": ["src"], | |
"ext": "ts", | |
"ignore": ["src/public"], | |
"exec": "NODE_ENV=development ts-node src/start.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
Show hidden characters
{ | |
"extends": "tslint:recommended", | |
"rules": { | |
"max-line-length": { | |
"options": [100] | |
}, | |
"member-ordering": false, | |
"no-consecutive-blank-lines": false, | |
"object-literal-sort-keys": false, | |
"ordered-imports": false, |
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
{ | |
"compilerOptions": { | |
"module": "commonjs", | |
"strict": true, | |
"baseUrl": "./", | |
"outDir": "build", | |
"removeComments": true, | |
"experimentalDecorators": true, | |
"target": "es6", | |
"emitDecoratorMetadata": true, |
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
{ | |
"watch": ["src"], | |
"ext": "ts", | |
"ignore": ["src/public"], | |
"exec": "ts-node src/start.ts dev" | |
} |
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 { Logger } from '@overnightjs/logger'; | |
import DemoServer from './DemoServer'; | |
// Start the server or run tests | |
if (process.env.NODE_ENV !== 'testing') { | |
let server = new DemoServer(); | |
server.start(process.env.NODE_ENV === 'development' ? 3001 : 8081); | |
} else { |
NewerOlder