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 8165453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:32:22+00:00 2026-06-06T19:32:22+00:00

I was wondering how one would go about developing a website from scratch with

  • 0

I was wondering how one would go about developing a website from scratch with Node.js.
I understand how I could possibly do it, but I am interested in the best design practice.

I need this theoretical website to:

  1. Do a lot of AJAX
  2. Be very straightforward
  3. Be relatively small
  4. Connect to… let’s say a MySQL server

In PHP, building a pretty small website was very straightforward – I set up PHP on Apache and a MySQL server and then do something like:

  • includes/db/ which has connect.php for connecting to the db, a file with common db related functions and so on
  • includes/layout/ which had stuff like footer.php, header.php, and other layout related stuff
  • includes/users/ to handle user related actions

Then PHP just let you build pages and include these files together to form a website – I could go something like:

<?php
   require_once('inclues/users/user_session.php');
   require_once('inclues/db/connect.php');
   require_once('inclues/design/header.php')
?>

// Other php or html or related content relating to the page

<?php
   require_once('inclues/.../footer.php');
?>

I was wondering what might be similar in Node.js – I am looking for a way to accomplish this which is as simple, fast and straightforward as possible.

If the answer is not simple, I would love a book recommendation, I don’t mind reading.

I love event based programming, I really love JavaScript’s abilities and I’m really excited about Node.js. I want to learn how to develop this sort of stuff with it the right way from the start.

  • 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-06T19:32:24+00:00Added an answer on June 6, 2026 at 7:32 pm

    To start with the bad news: As Node.js is a pretty young technique, I think you’ll find that the proces of creating a full fledged website and maintaining/operating it will be very different than what you’re currently used to.

    Josh3736 adds: Once you figure out how Node.js and its various packages (Connect, Express) work, I found that you can develop new sites very quickly.

    The rough edges that currently exist in Node.js, combined with the fast pace of its development and all modules involved can complicate things though, and make things less simple, fast and straightforward than you’d like.

    Having that out of the way, here’s the good news:

    The Node Package Manager, NPM has a lot of good tools and frameworks to expand Node.js’s bare bones functionality, making it suitable to create a webserver.

    Most notably would be the Express Framework which contains almost everything you need to run a webserver (including cookies, sessions and path routing). Additionally Express supports partials, which take care of your header and footer includes.

    Express is built on top of Sencha’s Connect. Cookies and sessions are actually powered by Connect. Express is what simplifies your routing and handles views/partials. So if you don’t need all bells and whistles that come with Express you could just go for Connect instead.

    If you like to use templates for these partials, the Jade Template Engine can speed things up for you. Though Josh3736 points out that Jade is slow and whitespace-significant. A more complete overview can be found here, which includes his favourite, doT. (I personally use Node.js for socket.io based applications only, so he’s a better source than me when it comes to templating).

    You can connect to MySQL from Node.js using the db-mysql module, but if you don’t need that because you’re accessing data connected to an already present system, I’d advise to use a more… ‘modern’ approach, which is to use a NoSQL database as most Node.js projects seem to do. MongoDB via Mongoose is the popular way to go.

    Or if it’s just storing objects you’re interested in, just go for Redis instead (which you’re probably going to need at some point anyway).

    Once your website is complete, you’ll have to deploy it and make sure it keeps running. There are many ways to do so, like using built-in cluster support or use the more feature-friendly forever npm module. See this SO question of mine for more information.

    Conclusion:

    What I’m trying to get at is this:

    Asking what the best practice for building a website in Node.js is, is about the same as asking what the best way to build a website in PHP is: 100 developers will give you 100 different answers.

    NPM is blessed with a variety of excellent frameworks that greatly simplify a lot of tasks involved, but it’s all based on preference which one is the way to go really.

    As I’ve said, Node.js is still a pretty young technique, so none of the frameworks or additional tools have emerged as ‘defacto standard’ yet; for most things you’re trying to do there are probably various alternatives, and expect your code to break when using most of them during updates, because development of Node.js itself and most modules is fast paced. You’ll have to keep up.

    Putting it all together:

    As I’ve said, my main production use for Node.js is to be able to use socket.io, so I don’t have any good production examples present (And as I’m about to leave on a well-deserved vacation I don’t have the time to put one together either). There are some good examples though:

    • Setup and deployment using Express and Jade
    • A very complete blog example using Express, Jade and MongoDB
    • Combining Restify (an extension of Express), Backbone.js and Mongoose

    Again, the way to go (and subsequently the example to follow) depends greatly on your ultimate goals and the techniques chosen, but luckily there are plenty of resources available for all of the choices available. Most modules use well documented GitHub repositories and include examples in combination with the most popular modules (See the /examples/ dir that seems to be present in most repositories).

    (thanks to Josh3736 for rectifying my errors.)

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

Sidebar

Related Questions

I was wondering how one would go about getting an object from a remote
How would one go about creating a 15 second countdown timer..I've seen NSTimer but
Just wondering how people would go about this. Say I have one class that
I'm wondering how I would go about running two separate queries within one mysqli_result.
I was wondering how one would go about using sqlite3 to validate users in
I was wondering how, in objective c, one would go about making a unit
Passing one class/struct vs passing several parameters I am wondering about performance considerations. Would
I'm new to using iterators and was wondering how one would iterate through each
In Business Intelligence Developer Studio, I'm wondering why one would want to create a
I was wondering if any one could help me out; I have a table

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.