An open API service indexing awesome lists of open source software.

https://github.com/andrei-markeev/express-mini

Minimalistic express-like webserver with zero dependencies
https://github.com/andrei-markeev/express-mini

expressjs http-server nodejs web-server

Last synced: 2 months ago
JSON representation

Minimalistic express-like webserver with zero dependencies

Awesome Lists containing this project

README

          

## express-mini

Minimalistic Express-like web server with zero dependencies.

### Installation

```
npm i @andrei-markeev/express-mini
```

### Usage

```ts

import * as app from "@andrei-markeev/express-mini"

app.get("/hello", async () => ({ text: "Hello world!" }));
app.get("/test", async () => ({ html: "

Test

" }));

app.listen(3000, __dirname + "/public", () => console.log("Server listens on port 3000"))

```

In this example, server will serve static files from the `public` folder (relative to the script directory).

If you don't need automatic static file serving, pass `null`.