Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 4 days 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 7 years ago)
- Default Branch: master
- Last Pushed: 2023-07-07T17:38:57.000Z (over 1 year ago)
- Last Synced: 2024-10-24T14:32:23.916Z (13 days ago)
- Topics: builder, express, http, http2, https, nodejs, server, simple
- Language: JavaScript
- Size: 8.77 MB
- Stars: 0
- Watchers: 3
- Forks: 3
- 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
[![NPM](https://nodei.co/npm/serverbuilder.png)](https://nodei.co/npm/serverbuilder/)
[![Inline docs](http://inch-ci.org/github/Berkmann18/ServerBuilder.svg?branch=master)](http://inch-ci.org/github/Berkmann18/ServerBuilder)[![devDependencies Status](https://david-dm.org/Berkmann18/ServerBuilder/dev-status.svg)](https://david-dm.org/Berkmann18/ServerBuilder?type=dev)
[![dependencies Status](https://david-dm.org/Berkmann18/ServerBuilder/status.svg)](https://david-dm.org/Berkmann18/ServerBuilder)[![GH Downloads](https://img.shields.io/github/downloads/Berkmann18/ServerBuilder/total.svg)](https://github.com/Berkmann18/ServerBuilder/network/members)
[![GitHub commit activity the past year](https://img.shields.io/github/commit-activity/y/Berkmann18/serverbuilder.svg)](https://github.com/Berkmann18/ServerBuilder/graphs/commit-activity)
[![GitHub contributors](https://img.shields.io/github/contributors/Berkmann18/ServerBuilder.svg)](https://github.com/Berkmann18/ServerBuilder/graphs/contributors)
[![Github search hit counter](https://img.shields.io/github/search/Berkmann18/ServerBuilder/goto.svg)](https://github.com/Berkmann18/ServerBuilder/graphs/traffic)[![Build Status](https://travis-ci.org/Berkmann18/ServerBuilder.svg?branch=master)](https://travis-ci.org/Berkmann18/ServerBuilder)
[![codecov.io Code Coverage](https://img.shields.io/codecov/c/github/Berkmann18/ServerBuilder.svg?maxAge=2592000)](https://codecov.io/github/Berkmann18/ServerBuilder?branch=master)
[![mocha](https://rawcdn.githack.com/aleen42/badges/11e00955d8be26223f0b89dddf49bc4a81e059ba/src/mocha.svg)](https://aleen42.github.io/badges/src/mocha.svg)
[![Known Vulnerabilities](https://snyk.io/test/github/Berkmann18/ServerBuilder/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Berkmann18/ServerBuilder?targetFile=package.json)[![GitHub](https://img.shields.io/github/license/Berkmann18/ServerBuilder.svg)](https://github.com/Berkmann18/ServerBuilder/blob/master/LICENSE)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/Berkmann18/ServerBuilder/issues)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&identifier=115825259)](https://dependabot.com)[![GitHub top language](https://img.shields.io/github/languages/top/Berkmann18/ServerBuilder.svg)](https://github.com/Berkmann18/ServerBuilder)
[![GitHub language count](https://img.shields.io/github/languages/count/Berkmann18/ServerBuilder.svg)](https://github.com/Berkmann18/ServerBuilder)
[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Berkmann18/ServerBuilder.svg)](https://github.com/Berkmann18/ServerBuilder)[![BCH compliance](https://bettercodehub.com/edge/badge/Berkmann18/ServerBuilder?branch=master)](https://bettercodehub.com/results/Berkmann18/ServerBuilder)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/40e42558e9ad4f54a014f063aa48817c)](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