Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8296741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:08:14+00:00 2026-06-08T15:08:14+00:00

What is the correct way to include css and js files in express project

  • 0

What is the correct way to include css and js files in express project ?

I am using ejs template engine. I have seen one example using connect-assetmanager but it was difficult to follow.

A small example project which includes css and js in index.ejs (not layout.ejs) would be very useful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:08:16+00:00Added an answer on June 8, 2026 at 3:08 pm

    Static files can be served with express’ static middleware. I usually make a directory for all static files to be served from the root.

    If you’ve installed express globally with npm (npm install -g express) you can type the following at the command line.

    express <project_name>
    

    This will create a small example project for you. This example project has a folder named public, from which it serves static files. It further contains folders named javascripts and stylesheets.

    The relevant piece of the example project for setting this up is the following line in the file app.js in the function passed to app.configure.

    app.use(express.static(path.join(__dirname, 'public')));
    

    Example is from express 3.0.0rc1

    Express is built on Connect. The docs for it’s static middleware might be helpful: Connect : Static

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the correct way to include files #include ../myDirecoty/myFile.h or #include ..\myDirecoty\myFile.h the
What is the correct way to use pygame.Color names when using unicode_literals ? Python
What is the correct way to do conditional formatting in Django? I have a
What is the correct/recommended way of including remote CSS style sheet in OpenSocial gadget
I'm wondering what the correct way to reset/unset the CSS behavior property is for
What is the correct way to include the JQuery libraries via a master page?
What is the correct way to include a select field within a nested form
For two threads manipulating a container map for example, what the correct way to
Is there a correct way to include multiple forms in a single table? For
In my Play 2.0 project I already have Bootstrap integrated (as the less files,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.