0

I am creating website using nodejs. i have lot of default js and css files from out of nodejs project file like assets. already i have created one public folder but i can not paste that folder inside that because that folder size is very big.how to call that files inside nodejs project.

folder structure:

assets

nodeproject
  node_modules
  public
  views 
  index.js
  package.json
  package-lock.json

my assets folder have lot of css and html files like:

  assets
    1.style1.css
    1.style2.css
    1.style3.css
    templatefolder:-
      template1.html
      template2.html

index.js:

    const express=require('express'); 
    const app=express();
    app.listen(4600); 
    app.use(express.static('public'));
    /*app.use(express.static('assets')); not working */

   app.set('view engine','ejs');
   app.get('/',(req,res)=>{ 
   res.render("home"); 
   });
snkranya
  • 43
  • 8
  • I don't understand this sentence : `i can not paste that folder inside that because that folder size is very big`. You can't paste a folder? What's the relation with importing files in Node? – Jeremy Thille Mar 09 '18 at 16:14
  • Ok...How to call out of folder's css file inside nodeprojects? – snkranya Mar 10 '18 at 08:30
  • You mean import all files in a directory, regardless of their number? This may help you : https://stackoverflow.com/questions/5364928/node-js-require-all-files-in-a-folder – Jeremy Thille Mar 12 '18 at 08:46

0 Answers0