Failed to lookup path nodejs

0

I am new with Node JS and I have a lot of doubts, now I try to create my own static files for the server, this is my file structure

   -ship.io
      -node_modules
      -public
        -api
        -css
        -images
        -js
        -views
   -server.js
   -package.json

and this is my path configuration

app.use(express.static(path.join(__dirname, 'public/')));
app.use('/img',express.static(path.join(__dirname, 'public/views')));
app.use('/js',express.static(path.join(__dirname, 'public/js')));
app.use('/css',express.static(path.join(__dirname, 'public/css')));

But when I do

app.get('/', (req, res, next) => {
    res.render('index.ejs',{
        Title: "ship.io"
    });
});

I get this error: 'c

Error: Failed to lookup view "index" in views directory

    
asked by Ernesto Emmanuel Yah Lopez 16.03.2018 в 00:07
source

0 answers