# noer

> Simple node webserver

Latest version **10.0.12** (published 2025-07-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install noer
pnpm add noer
yarn add noer
bun add noer
```

Provides the command `noer`.

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 10.0.12 |
| Published | 2025-07-31 |
| First published | 2023-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | alexsch01 |
| Maintainers | alexsch01 |
| Keywords | simple, node, webserver, web, server |

## Links

- npm: https://www.npmjs.com/package/noer
- npm.io page: https://npm.io/package/noer

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 10.0.12 (latest) — 2025-07-31
- 10.0.11 — 2025-07-31
- 10.0.10 — 2025-07-30
- 10.0.9 — 2025-07-30
- 10.0.8 — 2025-07-26
- 10.0.7 — 2025-07-26
- 10.0.5 — 2025-07-26
- 10.0.4 — 2025-07-25
- 10.0.2 — 2025-07-24
- 10.0.1 — 2025-07-24
- 10.0.0 — 2025-07-24
- 6.0.3 — 2025-07-23
- 6.0.2 — 2025-07-23
- 6.0.1 — 2025-07-23
- 6.0.0 — 2025-07-23
- … 43 more at https://npm.io/package/noer/versions

## README

# noer

Simple node webserver

https://github.com/alexsch01/noer

<br>

### Calculator Example

---

**public/index.html**
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Calculator</title>
</head>
<body>
    <h1>Calculator</h1>
    <form class="noerForm">
        <input name="left">
        <input name="right">
        <input name="action" value="add" hidden>
        <button>Add</button>
    </form>
    <br>
    <form class="noerForm">
        <input name="left">
        <input name="right">
        <input name="action" value="subtract" hidden>
        <button>Subtract</button>
    </form>
    <br>
    <form class="noerForm">
        <input name="left">
        <input name="right">
        <input name="action" value="multiply" hidden>
        <button>Multiply</button>
    </form>
    <br>
    <form class="noerForm">
        <input name="left">
        <input name="right">
        <input name="action" value="divide" hidden>
        <button>Divide</button>
    </form>
    <p id="results"></p>

    <script type="module" src="index.js"></script>
</body>
</html>
```

**public/index.js**
```js
const forms = document.querySelectorAll('form[class="noerForm"]')
for (const form of forms) {
    form.onsubmit = async (e) => {
        e.preventDefault()
        const data = Object.fromEntries(new FormData(e.target).entries())

        document.querySelectorAll('[name="left"]').forEach(elem => {
            elem.value = ''
        })
        document.querySelectorAll('[name="right"]').forEach(elem => {
            elem.value = ''
        })

        let json
        try {
            const resp = await fetch('/getData', {
                method: 'POST',
                body: JSON.stringify(data),
            })
            json = await resp.json()
        } catch(_) {}

        if (json === undefined) {
            document.querySelector('[id="results"]').innerHTML = 'Uh oh - check your server'
            return
        }

        document.querySelector('[id="results"]').innerHTML = json.results
    }
}
```

**server.js**
```js
//@ts-check
const noer = require('noer')

noer({
    publicDir: 'public/',
    port: 8080,
    routes: {
        '/getData': async (data) => {
            let answer, operator
            const left = parseFloat(data.left)
            const right = parseFloat(data.right)

            if(data.action === 'add') {
                answer = left + right
                operator = '+'
            }
            if(data.action === 'subtract') {
                answer = left - right
                operator = '-'
            }
            if(data.action === 'multiply') {
                answer = left * right
                operator = 'x'
            }
            if(data.action === 'divide') {
                answer = left / right
                operator = '/'
            }

            let results = ''
            if(Number.isFinite(answer)) {
                results = `${left} ${operator} ${right} = ${answer}`
            }

            return JSON.stringify({ results })
        }
    }
})
```

---

#### How To Run
Files in the `publicDir` directory will be cached after first load
```
node server.js
```
In a web browser, go to http://localhost:8080

#### Dev Mode
Files in the `publicDir` directory will be read from storage every load
```
node server.js --dev
```
In a web browser, go to http://localhost:8080

---
_Source: https://npm.io/package/noer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
