Where I work we have over a dozen internal SW systems that we have developed in-house using a variety of technologies, frameworks, and languages. Those include various from Microsoft (ASP.NET Web Forms, WebAPI, WinForms, SharePoint, Office Automation, Win8 Native Apps, SQL Server, SSRS) and others not from Microsoft (plain-old JS/HTML/CSS, PHP, Lithium, PostgreSQL, MySQL). Our SW dev team has grown and shrunk again to where it's just me and one other dev now. I love trying shiny new tech and taking advantage of different tools to get things done, which partly explains the huge span of different technologies we've chosen over the years, but we're suffering from the "jack of all trades, master of none" syndrome.

Now we've been told that the company is expecting significant new growth and that the two of us will need to produce a number of new applications over the next year. I'm ready to consolidate our skill sets and tool sets so that we can master the tools and focus more on the business problems we will face without having the slowdown of context switching between technologies. The two of us have been doing a lot of "plain old" JS/HTML5/CSS3 development recently and I would like to focus on that technology set moving forward.

We will be primarily using PostgreSQL as our data store on the back end (possibly augmenting with some NoSQL for very specific uses, and probably needing to find an advanced full-text search tool to integrate in). Our primary user interfaces will be a combination of traditional web apps and Single Page Apps (50%-50% mix), but there is the hope for native mobile apps down the line. Therefore I would like to expose our business data via a RESTful API so that it's easy to consume by various clients. And the most important factor in all of this is that I want to be able to code exclusively in Javascript from front to back (with the exception of writing SQL as necessary for the DB layer, and HTML5/CSS3 for the presentation).

This leaves me with the following questions:

  1. Is it possible today to code all these layers/components exclusively in Javascript without resorting, for example, to PHP on the server, or C# for the RESTful API (i.e., WebAPI)?
  2. Is node.js required to make this a reality, or can I use a non-node web server and still achieve the "Javascript-only" ideal? (related...would node.js just make more sense in a JS-only paradigm?)
  3. Are there any frameworks for building JS-only RESTful APIs that can talk to PostgreSQL?
  4. Are there any advanced full-text search tools (such as Lucene) that allow you to program against them with a JS-only approach?

4 Answers 4


Yes, you can is the short answer.

You need Node.js for the server side. On top of that, you can build whatever you can imagine. That will cover your first 2 questions.

You should check the expressjs framework.

You can find PostgreSQL connectors for node.js such as this one (I haven't tried it). Have in mind that, as Daniel already told you, the latest trend is towards NoSQL solutions so you can find a lot more in that direction (with MongoDB and CouchDB being more famous). You can have a look here.

About the full-text search tools, I've no idea. But since Lucene has SOLR to expose lucene over http, you could make the requests from your server side javascript. This is how they use it with PHP (links: stackoverflow, lucenetutorial).

Finally, have in mind that you can also have native C/C++ node.js modules and code in your projects. That can come handy when you face any node.js limitation.


Therefore I would like to expose our business data via a RESTful API so that it's easy to consume by...

..hackers, TFTFY. :)

I would really not try to make the DB 'easily consumable' by directly giving access to its tables. I would however, secure the DB with stored procedures that are the only interface to the DB (which is sort-of the same principle you're advocating only the API is a sproc one rather than a REST one) and then I would provide a set of services to provide an intermediary layer between the clients and the DB. These services can provide a REST API.

Not only do you improve security (if the clients don't have access to the DB, they can't abuse it) but you can provide a more logical set of APIs to clients without them having to know what the DB contains.

As for javascript everywhere, Node.JS is the thing you want. To get a beautiful tutorial, see the Node Beginner Book. Then grab a js library to make working with the system easier like express or restify.


It is possible to exclusively use JavaScript to do what you described. I wouldn't agree that Node.js is the only way to do that however. Not that Node.js isn't a great/powerful tool, but JavaScript is just one implementation of ECMAScript https://en.wikipedia.org/wiki/ECMAScript

I have been writing server-side applications in EMCAScript for years before Node.js existed with Microsoft's JScript on classic ASP pages. The JavaScript that is used in client code across the internet is almost completely compatible with the JScript that is run by classic ASP as well as JScript.NET! I port code between my client and server scripts on a regular basis by adding and removing any calls to the DOM (which doesn't exist on the server). I added JSON.stringify()/JSON.parse() to all of my ASP pages with a simple call to Crockfords secureParse.js so that the server and client have a simple mechanism for passing data. That's how compatible the two scripting languages are. Aside from JavaScript having access to the DOM and JScript having access to COM and server mechanisms (cache control,buffer, flush, Reponse.Write, etc) they are practically idenical...

Writing in JScript (ASP) or JScript.NET also gives you access to all of the COM resources available to the server through ActiveX controls, which I use for IO calls, encryption, compression, all the data transfer protocols (i.e. ftp,http,smtp, etc), direct printing, DB connection, and I have even been known to borrow spellchecker from MS Word with

Word = new ActiveXObject("Word.Application");

and without having to use anything further than JScript I can access the entire public facing API of any windows control :)

And for a faster execution, I write some modules that are fully encapsulated in the same JScript, then run it through a .NET compiler (called JSC.exe) and now the same code is no longer "interpreted", but compiled!

Unlike JavaScript (and therefore Node.js), this would require a windows server to run the server code. But you didn't say that that couldn't be a requirement...

I too like to be able to stick with what I know and not become a "Jack of all trades", but JavaScript is really the only language I know... So it helps that it's so flexible.


There are tools like Wakanda that allow you to author an entire client/server application in Javascript. PostgreSQL integration is possible, but a lot of these new-generation tools are NoSQL solutions.

  • Wakanda just added SQL Server and MySQL connectors however I think they are only in the Enterprise version. If you could get reports out of the thing, they might be onto something.
    – Alan B
    Feb 20, 2014 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.