Comments (2)
Hum, maybe I need to listen on both ports, 443 and 80.
from devcert.
import chalk from 'chalk';
import config from 'config';
import * as devcert from 'devcert';
import https from 'https';
import server from './app';
import type { Env } from './connection';
const port = config.get<number>('port');
const env = config.get<Env>('env');
const afterStart = (port: number) => {
return () => {
console.log(chalk.green('Server listening on port %d in %s.'), port, env);
};
};
try {
const httpsConfig = config.get<string | boolean>('https');
const isHttps = httpsConfig === 'true' || httpsConfig === true;
if (isHttps && env === 'development') {
const baseUrl = config.get<string>('baseUrl');
const ssl = await devcert.certificateFor(baseUrl);
const sslPort = config.get<number>('sslPort');
https.createServer(ssl, server).listen(sslPort, afterStart(sslPort));
}
server.listen(port, afterStart(port));
} catch (e) {
console.log(e);
throw e;
}
For anyone coming along and having the same issue (node 14.8+ for top-level async/await)
from devcert.
Related Issues (20)
- move @types/* into devDependencies HOT 1
- Multiple subject_alt_names HOT 1
- Trust certificate wizard fails on Windows HOT 1
- Certificate Length 825 days Mac Catalina HOT 6
- Prompts for password in windows and what to type there? HOT 5
- createCipher/createDecipher and new Buffer deprecated
- devcert is using debian specific commands for linux HOT 1
- Missing API docs
- Firefox manual cert install no longer works HOT 2
- localhost is not a valid domain name HOT 16
- Broken password explanation link HOT 1
- devcert is undefined. HOT 2
- High-Sev Warning: Uses outdated configstore 3.0.0 HOT 1
- Doesn't work on windows HOT 1
- Add intermediate CA with nameConstraint HOT 1
- Unable to create certificate for `local.domain.com` HOT 3
- Nothing
- Can't create certificate ".tech" domain name
- NET::ERR_CERT_DATE_INVALID suddenly happening on Chromium browsers?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from devcert.