npm.io
1.0.1 • Published 3 years ago

@made-simple/express

Licence
MIT
Version
1.0.1
Deps
4
Size
8 kB
Vulns
0
Weekly
0

@made-simple/express


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 @made-simple/express

Example Usage

import { Server } from "@made-simple/express"
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

Keywords