index.js: (placed inside of server
folder.)
const serve = require('koa-static')
const Koa = require('koa');
const app = new Koa();
app.use(serve(__dirname + './public'));
app.listen(3000);
console.log('listening on port 3000');
I want to show index.html
, which is located in /public
folder.
When I start index.js
above, I see Not Found
on the browser.
console.log
shows, it's referring to same folder where index.js
is.
UPDATE 1:
console.log(__dirname + './public');
shows
/Users/askar/work/react/hub/server./public
,
but I need /Users/askar/work/react/hub/public