简体   繁体   中英

How to serve css file using Restify

I am working with a node application, where I need to serve static files(js,css).

My project structure is like below:

-MyProject
     -backend
         -index.js
     -frontEnd
         -index.html
         -js
         -css

When I send the following I am able to load index.html. How can I serve the css too? Do I need to remake my project with express?

server.get(
  "/",
  restify.plugins.serveStatic({
    directory: __dirname,
    default: "frontend/index.html",
  })
);

I fixed it by switching to express.js instead

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM