Skip to content

Static serve middleware is not working #16

Open
@jbenguira

Description

@jbenguira

Bug Report

Is you/your team sponsoring this project

  • Yes
  • No

If your team sponsoring this project, please attach here your team lead or who purchased license GitHub login

Minimal reproducible repo

create a folder with index.js
Also create a subfolder "static" containing index.html with "hello world" in it

const nanoexpress = require('nanoexpress');
const staticServe = require('@nanoexpress/middleware-static-serve/cjs');
const path = require('path');
const app = nanoexpress();
app.use(staticServe(path.join(__dirname, 'static')));
app.get('/', (req, res) => {
    return res.send({ status: 'ok' });
});
app.listen(3000);

then open http://localhost:3000/index.html
this return: {"code":404,"message":"The route does not exist"}
but http://localhost:3000/ do return "hello world"

so the issue seems to be the routing for all other paths except "/"

Environment

  • Node/npm version: v12.14.0 / v 6.13.4
  • OS: Ubunutu 20.04
    "dependencies": {
    "@nanoexpress/middleware-static-serve": "^1.0.1",
    "nanoexpress": "^2.4.9"
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions