https://github.com/berkmann18/serverbuilder
Simple NodeJS/Express server builder
https://github.com/berkmann18/serverbuilder
builder express http http2 https nodejs server simple
Last synced: 8 months ago
JSON representation
Simple NodeJS/Express server builder
- Host: GitHub
- URL: https://github.com/berkmann18/serverbuilder
- Owner: Berkmann18
- License: mit
- Created: 2018-02-01T17:50:43.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-07-07T17:38:57.000Z (over 2 years ago)
- Last Synced: 2025-05-08T16:58:28.855Z (8 months ago)
- Topics: builder, express, http, http2, https, nodejs, server, simple
- Language: JavaScript
- Size: 8.77 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# ServerBuilder
[](https://nodei.co/npm/serverbuilder/)
[](http://inch-ci.org/github/Berkmann18/ServerBuilder)
[](https://david-dm.org/Berkmann18/ServerBuilder?type=dev)
[](https://david-dm.org/Berkmann18/ServerBuilder)
[](https://github.com/Berkmann18/ServerBuilder/network/members)
[](https://github.com/Berkmann18/ServerBuilder/graphs/commit-activity)
[](https://github.com/Berkmann18/ServerBuilder/graphs/contributors)
[](https://github.com/Berkmann18/ServerBuilder/graphs/traffic)
[](https://travis-ci.org/Berkmann18/ServerBuilder)
[](https://codecov.io/github/Berkmann18/ServerBuilder?branch=master)
[](https://aleen42.github.io/badges/src/mocha.svg)
[](https://snyk.io/test/github/Berkmann18/ServerBuilder?targetFile=package.json)
[](https://github.com/Berkmann18/ServerBuilder/blob/master/LICENSE)
[](https://github.com/Berkmann18/ServerBuilder/issues)
[](http://commitizen.github.io/cz-cli/)
[](https://dependabot.com)
[](https://github.com/Berkmann18/ServerBuilder)
[](https://github.com/Berkmann18/ServerBuilder)
[](https://github.com/Berkmann18/ServerBuilder)
[](https://bettercodehub.com/results/Berkmann18/ServerBuilder)
[](https://www.codacy.com/app/maxieberkmann/ServerBuilder?utm_source=github.com&utm_medium=referral&utm_content=Berkmann18/ServerBuilder&utm_campaign=Badge_Grade)
It's a simple NodeJS/Express server builder allowing you to get a working server up in just a few lines.
## Install
To install it you need to run the following:
```cli
npm i serverbuilder
```
_Note_: Don't forget to use `-g`, `--save`, `--save-dev` if appropriate.
## Usage
- Using **HTTP/1**:
```js
const app = require('express')(),
Server = require('serverbuilder');
const options = {
name: 'My Server',
publicIP: true
};
const server = new Server(app, process.env.PORT || 3e3, options);
server
.run()
.then(serv => app.set('port', serv.port), console.error);
```
- Or with **HTTPS/1**:
```js
const fs = require('fs'),
app = require('express')(),
Server = require('serverbuilder');
const options = {
name: 'My Server',
useHttps: true,
securityOptions: {
key: fs.readFileSync('server-key.pem'),
cert: fs.readFileSync('server-cert.pem')
},
publicIP: true
};
const server = new Server(app, process.env.PORT || 3e3, options);
server
.run()
.then(serv => app.set('port', serv.port), console.error);
```
- Or with **HTTP/2**:
```js
const fs = require('fs'),
app = require('express')(),
Server = require('serverbuilder');
const options = {
name: 'My Server',
useHttp2: true,
securityOptions: {
key: fs.readFileSync('server-key.pem'),
cert: fs.readFileSync('server-cert.pem')
},
publicIP: true
};
const server = new Server(app, process.env.PORT || 3e3, options);
server
.run()
.then(serv => app.set('port', serv.port), console.error);
```
## Contribution
If you discover bugs, errors or/and have suggestions/feedback please create an [issue](http://github.com/Berkmann18/ServerBuilder/issues) or/and submit a [PR](http://github.com/Berkmann18/ServerBuilder/pulls).
If you want to contribute, make sure you stick with the coding style that ESLint is enforcing (cf. configuration file).
To check if a file stick to the standards:
```cli
eslint -c ./config/.eslintrc.js yourFile.js
#Or `npm lint` if appropriate
```
To fix formatting errors and such, run:
Same as above but with `--fix` at the end.
Fore more details, please check [the contribution guideline](./github/CONTRIBUTING.md).
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

Maximilian Berkmann
🐛 💻 📖 🤔 💬 👀 🛡️ ⚠️

Dependabot
🔧 🛡️

Semantic Release Bot
📖 📦

Snyk bot
🛡️
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
## License
MIT