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

  • Home
  • SEARCH
  • 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 8094481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:48:35+00:00 2026-06-05T20:48:35+00:00

I’m using ExpressJS with normal HTML templates (no Jade or similar template engines). Since

  • 0

I’m using ExpressJS with normal HTML templates (no Jade or similar template engines). Since I’m about to add MongoDB to my App, I need to inject data in to my HTML files. I know that it’s no problem when I use Jade or similar template engines. Is it possible to directly inject it to my HTML files without using Jade? If not, is it possible to use Jade and still having my HTML files?

Here is my app.js:

var express = require('express');
var server = express.createServer();

server.configure(function () {
  server.use('/bootstrap', express.static(__dirname + '/bootstrap'));
  server.use('/css', express.static(__dirname + '/css'));
  server.use('/js', express.static(__dirname + '/js'));
  server.use(express.static(__dirname + '/html'));
});
server.set('views', __dirname + '/html');
server.register('.html', require('handlebars'));
server.set('view options', { layout: false });
server.use(express.bodyParser());
server.use(express.cookieParser({ secret: "keyboard cat" }));
var memStore = require('connect').session.MemoryStore;
server.use(express.session({ secret: "keyboard cat", store: memStore( {
  reapInterval: 60000 * 10
})}));

server.listen(1337);
console.log('Express server started on port %s', server.address().port);

/** SESSIONS **/
function requiresLogin(req, res, next) {
  if (req.session.user) {
    next();
  }
  else {
    res.redirect('/login'); // TODO: process redirect
  }
}

var pseudoUsers = require('./users');

server.get('/login', function(req, res) {
  res.render('login.html');
});
server.post('/authenticated', function(req, res) {
  pseudoUsers.authenticate(req.body['emailInput'], req.body['passwordInput'], function(user) {
     if (user) {
       req.session.user = user;
       res.redirect('/dashboard');
     }
     else {
       res.redirect('/login?wrongCredentials=true');
     }
  });
});

/* ROUTERS ****************/
/**************************/
server.get('/home', function(req, res) {
  res.render('index.html');
});
[some more routes..]
  • 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-05T20:48:38+00:00Added an answer on June 5, 2026 at 8:48 pm

    On the assumption that you need to inject dynamic data (data that changes over time and has other dependencies, like usernames etc), you will be using templates one way or the other. If you are not willing to use any pre-made template engine, most likely you will end up creating your own which will most likely be inferior to most of the other engines that have some billion pageviews behind them.

    You specifically mention that you do not want to use Jade. But your code does pull in handlebars which is another template engine (http://handlebarsjs.com/), which basically allow you to mix variables with your html templates using {{ somevarref }}.

    You could also avoid templates all together and create all your html dynamically with code, but that’s usually done behind the scenes for you with any template engine, so why go through all that trouble manually?

    Finally, you could also do generate your html client side, possibly using DOM manipulation to get all the right pieces in place, but based on your question I’m guessing either that does not fit your use case, and/or that’s probably a bit beyond what is currently needed.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
We're building an app, our first using Rails 3, and we're having to build
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.