# expressjs-app

> ExpressJS API for simple lightweight projects

Latest version **1.4.7** (published 2026-03-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install expressjs-app
pnpm add expressjs-app
yarn add expressjs-app
bun add expressjs-app
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.4.7 |
| Published | 2026-03-03 |
| First published | 2023-03-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 18.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Nino Casupanan |
| Maintainers | nnocsupnn |
| Keywords | expressjs, api, medicard |

## Links

- npm: https://www.npmjs.com/package/expressjs-app
- Repository: https://github.com/nnocsupnn/expressjs-app
- Homepage: https://github.com/nnocsupnn/expressjs-app#readme
- Issues: https://github.com/nnocsupnn/expressjs-app/issues
- npm.io page: https://npm.io/package/expressjs-app

## Dependencies (12)

- [cors](https://npm.io/package/cors.md) ^2.8.6
- [helmet](https://npm.io/package/helmet.md) ^8.1.0
- [morgan](https://npm.io/package/morgan.md) ^1.10.1
- [express](https://npm.io/package/express.md) ^5.2.1
- [passport](https://npm.io/package/passport.md) ^0.7.0
- [body-parser](https://npm.io/package/body-parser.md) ^2.2.2
- [memory-cache](https://npm.io/package/memory-cache.md) ^0.2.0
- [passport-jwt](https://npm.io/package/passport-jwt.md) ^4.0.1
- [swagger-jsdoc](https://npm.io/package/swagger-jsdoc.md) ^6.2.8
- [express-session](https://npm.io/package/express-session.md) ^1.19.0
- [swagger-ui-express](https://npm.io/package/swagger-ui-express.md) ^5.0.1
- [rotating-file-stream](https://npm.io/package/rotating-file-stream.md) ^3.2.9

## Recent versions

- 1.4.7 (latest) — 2026-03-03
- 1.2.7 (expressjs-app@1.2.7) — 2023-04-01
- 1.4.6 — 2024-02-16
- 1.4.5 — 2024-02-16
- 1.4.4 — 2024-02-16
- 1.4.3 — 2024-01-19
- 1.4.2 — 2023-11-07
- 1.4.1 — 2023-11-07
- 1.4.0 — 2023-11-07
- 1.3.9 — 2023-11-07
- 1.3.8 — 2023-10-31
- 1.3.7 — 2023-10-31
- 1.3.6 — 2023-04-12
- 1.3.5 — 2023-04-12
- 1.3.4 — 2023-04-12
- … 20 more at https://npm.io/package/expressjs-app/versions

## README

## ExpressJS API - Custom Implementation

: This project was intially developed to customized and ease the usage of configuring express framework.

---

## Installation

```bash
npm install expressjs-app
```

## Usage

```javascript
const { ExpressApi, LogOption } = require("expressjs-app")

const app = (router, ...args) => {
    router.get('/', (req, res) => {
        res.json({
            status: 200,
            message: "Hello, Shits!"
        })
    })

    return router
}

const headers = (req, res, next) => {
    res.set('Access-Control-Allow-Methods', 'GET,POST');
    next()
}

const unauthorize = (err, req, res, next) => {
    if (err.name === 'AuthenticationError') {
        // Send a customized response for authentication failure
        return res.status(err.status).json({ 
            status: err.status,
            message: 'Invalid Authorization header supplied.\nPlease contact support or check your credentials.'
        })
    }

    next()
}

const apiOptions = { 
    enableCors: true, 
    // lastRouteHandler: invalid, // Method for handling 404 not found routes
    // docsModule: swaggerDoc, // Swagger Docs
    enableLog: true, // Log option can also accept LogOption { path: '/logs' }
    // jwtStrategy: jwtStrategy // JWT Strategy, this package uses passport-jwt for authentication, if this provided as option make sure you enable `registerAuthenticationRoute`
}

const apiInstance = new ExpressApi(apiOptions)
apiInstance.registerRoutesGroup(
        "/api",
        {
            method: app, args: undefined, name: 'app'
        }
    )
    .registerMiddlewares(headers, unauthorize)
    // Start the API/App
    .start(async () => {
        console.log('Server Started')
    })

```

---

## Configuration

```env
NODE_ENV=staging
API_BASE_PATH=/
SECRET_KEY=pass123!
PORT=3000

# OPTIONAL
LOG_FORMAT=combined # default 'combined',
LOG_SIZE='10M' # default '10M',
LOG_INTERVAL='1d' # default '1d',
LOG_MAX_FILES=10 # default 10
```

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