Skip to content

Instantly share code, notes, and snippets.

View seanpmaxwell's full-sized avatar
🎯
Focusing

Sean Maxwell seanpmaxwell

🎯
Focusing
View GitHub Profile
@seanpmaxwell
seanpmaxwell / package.json
Last active May 29, 2019 15:02
ExpressTypeScript/package.json
{
"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"
@seanpmaxwell
seanpmaxwell / start.ts
Created April 15, 2019 05:38
ExpressTypeScript/start.ts
import ExampleServer from './ExampleServer';
const exampleServer = new ExampleServer();
exampleServer.start(3000);
@seanpmaxwell
seanpmaxwell / ExampleServer.ts
Last active May 29, 2019 15:01
ExpressTypeScript/ExampleServer.ts
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() {
@seanpmaxwell
seanpmaxwell / ExampleController.ts
Last active May 29, 2019 14:59
ExpressTypeScript/ExampleController.ts
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);
@seanpmaxwell
seanpmaxwell / package.json
Last active May 29, 2019 14:53
ExpressTypeScript/package.json
{
"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\"/",
@seanpmaxwell
seanpmaxwell / nodemon.json
Last active May 29, 2019 05:40
ExpressTypeScript/nodemon.json
{
"watch": ["src"],
"ext": "ts",
"ignore": ["src/public"],
"exec": "NODE_ENV=development ts-node src/start.ts"
}
@seanpmaxwell
seanpmaxwell / tslint.json
Last active May 29, 2019 14:52
ExpressTypeScript/tslint.json
{
"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,
@seanpmaxwell
seanpmaxwell / tsconfig.json
Last active May 29, 2019 14:52
ExpressTypeScript/tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"strict": true,
"baseUrl": "./",
"outDir": "build",
"removeComments": true,
"experimentalDecorators": true,
"target": "es6",
"emitDecoratorMetadata": true,
@seanpmaxwell
seanpmaxwell / nodemon.json
Created February 14, 2019 00:34
TypeScriptFullStackShell/util/nodemon.json
{
"watch": ["src"],
"ext": "ts",
"ignore": ["src/public"],
"exec": "ts-node src/start.ts dev"
}
@seanpmaxwell
seanpmaxwell / start.ts
Last active May 29, 2019 05:32
TypeScriptFullStackShell/start.ts
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 {