roster-server 1.5.8 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/demo/www/manual.js +1 -1
- package/index.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -111,6 +111,16 @@ module.exports = (httpsServer) => {
|
|
|
111
111
|
};
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
+
4. **Manual**:
|
|
115
|
+
```javascript:demo/www/manual.js
|
|
116
|
+
roster.register('example.com', (httpsServer) => {
|
|
117
|
+
return (req, res) => {
|
|
118
|
+
res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
119
|
+
res.end('"Loco de pensar, queriendo entrar en razón, y el corazón tiene razones que la propia razón nunca entenderá."');
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
114
124
|
### Running the Server
|
|
115
125
|
|
|
116
126
|
```bash
|
package/demo/www/manual.js
CHANGED
|
@@ -6,7 +6,7 @@ const roster = new Roster({
|
|
|
6
6
|
email: 'admin@example.com',
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
roster.
|
|
9
|
+
roster.register('example.com', (httpsServer) => {
|
|
10
10
|
return (req, res) => {
|
|
11
11
|
res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
12
12
|
res.end('"Loco de pensar, queriendo entrar en razón, y el corazón tiene razones que la propia razón nunca entenderá."');
|
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ class Roster {
|
|
|
15
15
|
this.hostname = options.hostname || '0.0.0.0';
|
|
16
16
|
this.filename = options.filename || 'index';
|
|
17
17
|
|
|
18
|
-
const port = options.port
|
|
18
|
+
const port = options.port === undefined ? 443 : options.port;
|
|
19
19
|
if (port === 80) {
|
|
20
20
|
throw new Error('⚠️ Port 80 is reserved for ACME challenge. Please use a different port.');
|
|
21
21
|
}
|
|
@@ -168,7 +168,7 @@ class Roster {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
register(domain, requestHandler) {
|
|
172
172
|
if (!domain) {
|
|
173
173
|
throw new Error('Domain is required');
|
|
174
174
|
}
|
|
@@ -204,7 +204,7 @@ class Roster {
|
|
|
204
204
|
this.handleRequest(req, res);
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
-
greenlock.ready(glx => {
|
|
207
|
+
return greenlock.ready(glx => {
|
|
208
208
|
// Obtener los servidores sin iniciarlos
|
|
209
209
|
const httpsServer = glx.httpsServer(null, app);
|
|
210
210
|
const httpServer = glx.httpServer();
|