Skip to content

Commit cf97bf0

Browse files
committed
server-ssl.js
add S_SSL.respondWithContent add S_SSL.respondWithNotFound add S_SSL.respondWithServerError Adds some helpers so you can use to easily respond to api requests keep in mind you can remove everything inside HTTPS_SERVER and do whatever you like, this doesn't have to be a "web server" fixes a bug that meant error pages didn't have the correct error code /root │ ├── /error │ ├── 404.html │ └── 500.html │ ├── /ssl │ ├── /openssl │ ├── /module │ │ ├── /crypt │ │ ├── /jose │ │ └── lets-encrypt-acme-client.js │ │ │ ├── acmeKeys │ ├── private-key.pem │ └── certificate.pem │ └── ssl.js │ ├── /website │ └── index.html <---- Your website goes here │ ├── node.exe ├── server-ssl.js <--- server config └── start-windows.bat
1 parent aabef1f commit cf97bf0

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# server-ssl.js
44

5-
Easy to configure `SSL Web Server` that can be used for development or production
5+
Easy to configure `SSL Server` that can be used for development or production
66

77
`HTTP` requests are redirected to `HTTPS`
88

@@ -14,7 +14,7 @@ Designed to get out of your way, you can still change anything about the server.
1414

1515
### Getting Started
1616

17-
It can be as simple as this:
17+
The easiest usage would be to serve a website:
1818

1919
1. [`Clone`](https://github.com/FirstTimeEZ/server-ssl.git) or [`Download`](https://github.com/FirstTimeEZ/server-ssl/archive/refs/heads/main.zip) the main branch and extract it somewhere
2020
2. Put your website in the `website` folder
@@ -80,6 +80,20 @@ The certificates will be changed automatically when they are updated, you don't
8080

8181
--------
8282

83+
### Anything [Node.js](https://nodejs.org/docs/latest/api/) can do..
84+
85+
At the end of the day, this is just a [`Node.js`](https://nodejs.org/docs/latest/api/) server that sets up `SSL` automatically
86+
87+
```
88+
const HTTPS_SERVER = createServerHTTPS(S_SSL.loadDefaultSecureContext(), (req, res) => {
89+
// do whatever you like
90+
}).on('error', (e) => e.code === S_SSL.ADDR_IN_USE && console.error(`${S_SSL.optPort}${S_SSL.IN_USE}`)).listen(S_SSL.optPort, (err) => err ? console.error(S_SSL.ERROR_STARTING, err) : console.log(`${S_SSL.STARTED_HTTPS}${S_SSL.optPort}`));
91+
```
92+
93+
You can remove everything inside `HTTPS_SERVER` and do whatever you like, there are also helpers you can use in `S_SSL`
94+
95+
--------
96+
8397
### Default Structure
8498

8599
This structure is designed to keep the project organized and maintainable, separating error handling, website content, and server configuration.

0 commit comments

Comments
 (0)