Minimalist server creation and management library
import { ServerShell } from 'https://deno.land/x/tsmservershell/mod.ts';
const app = new ServerShell()
app.listen()You can use a specific configuration, using Deno.ServeOptions as a basis :
const app = new ServerShell({
port: 3000
})
app.listen()Use the public methods to add routes going to a specific path of your application, and bind them to a function that will run for all incoming requests going to that route.
The req parameter represents the Request object, and the info parameter represents Deno.ServeHandlerInfo
app.get("/get", (req, info) => {
// Route callback
})
app.post("/post", (req, info) => {
// Route callback
})The middleware function will be called for every incoming requests
app.use((req, info) => {
// Middleware function
})app.useStatic("./static/directory", "/route/root")