1

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",
  })
);
  • This can be found in this answer: https://stackoverflow.com/questions/19281654/serving-static-files-with-restify – HeadCode May 25 '20 at 15:36

1 Answers1

0

I fixed it by switching to express.js instead