Created
March 2, 2020 19:19
-
-
Save meditto/d2c7ab6d8de3eccb8b5bc6f646d0988a to your computer and use it in GitHub Desktop.
use SSL on Adonis 5 dev 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
/* | |
|-------------------------------------------------------------------------- | |
| AdonisJs Server | |
|-------------------------------------------------------------------------- | |
| | |
| The contents in this file is meant to bootstrap the AdonisJs application | |
| and start the HTTP server to accept incoming connections. You must avoid | |
| making this file dirty and instead make use of `lifecycle hooks` provided | |
| by AdonisJs service providers for custom code. | |
| | |
*/ | |
import 'reflect-metadata'; | |
import sourceMapSupport from 'source-map-support'; | |
import { Ignitor } from '@adonisjs/core/build/src/Ignitor'; | |
import https from 'https'; | |
import path from 'path'; | |
import fs from 'fs'; | |
const options = { | |
key: fs.readFileSync(path.join(__dirname, 'path to certificate.key from build folder')), | |
cert: fs.readFileSync(path.join(__dirname, 'path to certificate.crt from build folder')) | |
}; | |
sourceMapSupport.install({ handleUncaughtExceptions: false }); | |
new Ignitor(__dirname) | |
.httpServer() | |
.start((handler: any) => https.createServer(options, handler)) | |
.catch(console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment