I am trying to create a HTTPS server with express and typescript and here is my code, for some reason the https.createserver seems to never be working and i get this error:
UnhandledPromiseRejectionWarning: Error: error:0909006C:PEM routines:get_name:no start line
but i am new in this and i have found 0 answers online.
On my App.ts in the contructor i have:
this.express= express();
const key = fs.readFileSync('/home/user/private.key');
const cert = fs.readFileSync('/home/user/file.csr');
this.middlewares();
this.routes();
this.app = https.createServer({ key, cert }, this.express);
And the function listen that initializes the app:
listen() {
this.app.listen(3000);
console.log('Server on port', 3000);
}
On my index.ts
import { App } from './app'
import { connect } from './database'
function main() {
const app = new App(4001);
app.listen();
}
main();