Express is a minimal and flexible Node.js web application framework, providing a robust set of features (regex-based routing, sessions, multiple view / templating engines) for building single and multi-page, and hybrid web applications.

learn more… | top users | synonyms (2)

0
votes
0answers
9 views

Validation in Node.js

I'm building a NodeJS application, but I'm not sure what will be the best way to structure my code. I have the following model: ...
13
votes
1answer
137 views

Making an efficient and healthy db call for a real-time browser game

I'm doing a calculation for a real-time browser game, where users can invest some of their balances to the site. I need to update their invest's based on ...
2
votes
2answers
54 views

Is my Node/Express-based authentication implementation with session properly done?

I know that Passport.js exists, however, I wanted to code my own implementation using express-session module. I'm using: Express Mongoose express-session So I basically have 2 routes for handling ...
2
votes
1answer
59 views

ExpressJS easily serve static files

I have a NodeJS package, staticize, which takes an object of HTTP routes -> file locations, then serves them dynamically on each request. Could I get some feedback on the latest rewrite of the main ...
1
vote
1answer
141 views

Mongoose promise & error handling

I search for rails-like way of writing NodeJS code and it's more then hard to find the right way. The code quickly become bloated and unreadable. I would like my code to be as clean as possible. ...
0
votes
1answer
47 views

Controller making request to an external API

I'm starting on a new node/express backend and really want to keep everything clean and well tested. My previous project got a bit out of hand (in terms of test coverage and highly coupled code). So ...
2
votes
2answers
74 views

AJAX call to make an HTTP request

I am using node.js with express. There is a button that the user can click, and doing so calls this method on the server: ...
3
votes
1answer
53 views

Optimizing a Node.io server code for self-balancing robot

I am building a 3D printed self-balancing robot, and use the attached server script to control it. I coded using node.io, express and socket.io. The system is working, but I would appreciate some ...
2
votes
1answer
80 views

Simple web application for benchmark

There is an article where the author tries to compare performance of different web stacks. The result looks pretty controversial. I try to prove that in real use case the difference between scores of ...
2
votes
1answer
40 views

Pyramidal promises

I have a situation in my Node (express) controller where I need to check whether a particular language has a parent language, if it does, I need to do a new DB (SQL) call to retrieve the parent ...
3
votes
2answers
3k views

Exporting routes in node.js Express 4

I'm using Express 4 to provide routes to HTML/Jade files, and as well to provide an API. I want to separate routes from server file, and go even further- separate API from WWW. My code now looks like ...
0
votes
1answer
75 views

Testing individual nodes launched by naught using supertest

The purpose: an express node.js server which can be launched using naught, with an integration test using supertest. Each worker naught runs will test itself on a unique port, and only if passes it ...
4
votes
2answers
399 views

Modularize this node.js express server code for routes and session handlers?

I have express node.js server code using Passport. It receives a user to authenticate it and ...
3
votes
2answers
69 views

Node exports, architecture

My project is written in node JS + Express and has the following architecture: routes (e.g controllers) models (stateless functional modules) app Models objects only doing SQL queries like this: ...
5
votes
1answer
279 views

Express.js controller with Node.js style exports.methods

I have some Node/Express.js controllers which implement the exports.method Node module convention. This particular controller also has a few helper methods. The code works fine! However, I'm a ...
4
votes
1answer
62 views

How can I DRY this .ejs file up a bit?

For a few reasons I had to use EJS on a specific page in my Express project. This was previously like 13 lines of code with MustacheJS and a small JSON file. But now that it is hard-coded, it is a ...
3
votes
1answer
105 views

I'm torn between conditionals and abrupt return functions

Which one of these two is better? This one: ...
2
votes
1answer
151 views

Are these architectural styles correct?

I've start learning node, and would like to ask node and express framework gurus out there as to whether or not the following architectural styles are correct. These correspond to node modules, ...
2
votes
1answer
4k views

Serving static assets through wildcard rule

I wrote this as a way to deliver static portion of the app. I'm wondering if there is a better way to write this, as I am new to Express. The goal is to let a single-page app to handle routing as ...
2
votes
1answer
325 views

Saving and listing Category model

I have this ExpressJS route for saving and listing Category model. ...
1
vote
2answers
5k views

Populating an unordered list from values in a JSON file

I have this view that populates an unordered list from values in a JSON file, which I am doing in Node. Is there a better way to do this, or a more 'node-like' way? Can I load the JSON file without ...
0
votes
1answer
417 views

Express, blade with connect-assets

I have this CoffeeScript code running here (with TZM-Blade) and would like to have your opinion on how to better optimize it. ...
1
vote
1answer
152 views

Render arbitrary jade in express

We've got a "catch-all" in app.js that renders a .jade file if it exists: ...
3
votes
1answer
667 views

Socket.io, Express and Delivering realtime data from backend socket

I've got server running to make serial data available on a TCP/IP port. My goal is to collect data coming from a realtime device connected to the serial port and deliver it to web clients connected to ...