1.0.1 • Published 2 years ago

basic-express-framework v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Basic Express Framework


Shifts the work of setting up an Express server to an easy to use class. Allowing you to focus on the more important stuff.

Installation

npm install basic-express-framework

Example Usage

import { Server } from "basic-express-framework"
const server = new Server() // creates a new http server

server.get("/", (req, res) => {
    res.send("Hello World!")
})

server.start(3000)

Examples

Adding a folder of routes

server.addFolder("./routes")

Creating a route file

// ./routes/index.js

export function link(app, ...) {
    app.get(url, (req, res) => {
        res.send("Hello World!")
    })
}

Running HTTPS

const server = new Server("/etc/letsencrypt/live/example.com/")
server.start() // starts the server on port 443 and redirects http to https

Running HTTP

const server = new Server()
server.start()

License

MIT

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Repository

Contributors

@alexasterisk