update readme and adds ssl

This commit is contained in:
Joseph Ditton 2021-11-03 19:25:40 -06:00
parent 6dd39fcd58
commit ceb7e5cf2c
5 changed files with 28 additions and 28 deletions

View File

@ -1 +1,2 @@
PORT=3000 PORT=3000
NODE_ENV=development

1
.gitignore vendored
View File

@ -35,3 +35,4 @@ lerna-debug.log*
!.vscode/extensions.json !.vscode/extensions.json
.env .env
*.pem

View File

@ -1,30 +1,18 @@
<p align="center"> # Nest Starter App
<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>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
## Description ## 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 ## Installation

View File

@ -1,5 +1,5 @@
{ {
"name": "on-the-spot", "name": "nest-starter-app",
"version": "0.0.1", "version": "0.0.1",
"description": "", "description": "",
"author": "", "author": "",

View File

@ -1,11 +1,21 @@
import { config } from 'dotenv'; import { config } from 'dotenv';
import * as fs from 'fs';
import { NestFactory } from '@nestjs/core'; import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module'; import { AppModule } from './app.module';
config(); config();
async function bootstrap() { 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); await app.listen(process.env.PORT);
} }
bootstrap(); bootstrap();