diff options
-rw-r--r-- | .env.example | 3 | ||||
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | README.md | 36 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/main.ts | 12 |
5 files changed, 28 insertions, 28 deletions
diff --git a/.env.example b/.env.example index c0c68b1..56dc61b 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ -PORT=3000
\ No newline at end of file +PORT=3000 +NODE_ENV=development
\ No newline at end of file @@ -34,4 +34,5 @@ lerna-debug.log* !.vscode/launch.json !.vscode/extensions.json -.env
\ No newline at end of file +.env +*.pem
\ No newline at end of file @@ -1,30 +1,18 @@ -<p align="center"> - <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a> -</p> - -[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 -[circleci-url]: https://circleci.com/gh/nestjs/nest - - <p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p> - <p align="center"> -<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a> -<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a> -<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a> -<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a> -<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a> -<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a> -<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a> -<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a> - <a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a> - <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a> - <a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a> -</p> - <!--[](https://opencollective.com/nest#backer) - [](https://opencollective.com/nest#sponsor)--> +# Nest Starter App ## Description +A starter app with LTI1p0 enabled for NestJS -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. +## Setup +Create a file in the root called `.env` and copy the contents of `.env.example` + +## SSL +Create a ssl key and certificate an place them in the root directory + +```bash +$ openssl req -x509 -newkey rsa:4096 -keyout private-key.pem -out public-cert.pem -sha256 -nodes +``` +Where this key will only be used for development you can leave all of the information blank. ## Installation diff --git a/package.json b/package.json index 7294bd0..bac5533 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "on-the-spot", + "name": "nest-starter-app", "version": "0.0.1", "description": "", "author": "", diff --git a/src/main.ts b/src/main.ts index 90ecef4..4483c3b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,11 +1,21 @@ import { config } from 'dotenv'; +import * as fs from 'fs'; import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; config(); async function bootstrap() { - const app = await NestFactory.create(AppModule); + let httpsOptions; + if (process.env.NODE_ENV === 'development') { + httpsOptions = { + key: fs.readFileSync('./private-key.pem'), + cert: fs.readFileSync('./public-cert.pem'), + } + } + const app = await NestFactory.create(AppModule, { + httpsOptions + }); await app.listen(process.env.PORT); } bootstrap(); |