hqjs / hq

Lightning fast, zero configuration, web application development server
https://hqjs.org
MIT License
126 stars 11 forks source link

Not working . #17

Closed ghost closed 4 years ago

ghost commented 4 years ago

Steps to reproduce :

Create a folder and in it execute :

npm init -y;
npm install -g @hqjs/hq;

Then create ./index.html and in it add :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    hello world
</body>
</html>

then execute :

hq;

and go to the localhost prompted by the terminal . The web page shows this message :

File / not found
NotFoundError: File / not found
    at Object.throw (/home/lillallol/.nvm/versions/node/v14.5.0/lib/node_modules/@hqjs/hq/node_modules/koa/lib/context.js:97:11)
    at resolveSrc (file:///home/lillallol/.nvm/versions/node/v14.5.0/lib/node_modules/@hqjs/hq/middlewares/resolve-path.mjs:116:31)
    at async file:///home/lillallol/.nvm/versions/node/v14.5.0/lib/node_modules/@hqjs/hq/middlewares/resolve-path.mjs:36:5
    at async cors (/home/lillallol/.nvm/versions/node/v14.5.0/lib/node_modules/@hqjs/hq/node_modules/@koa/cors/index.js:56:32)
    at async file:///home/lillallol/.nvm/versions/node/v14.5.0/lib/node_modules/@hqjs/hq/middlewares/error-handler.mjs:5:5
hqjs commented 4 years ago

Point main field in your package.json to index.html or remove it completely. Otherwise you will have to specify /index.html as a part of the URL.

ghost commented 4 years ago

@hqjs I added /index.html at the end of the url and it works . Thx .