1.0.1 • Published 2 years ago
@made-simple/express v1.0.1
@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
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Repository
Contributors
1.0.1
2 years ago