Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Node.JS can access external data-sources but it should be used wisely.  A Node.JS application runs in the context of the front end.  Frontend components should NOT be directly accessing data-sources.  However, they can access some kind of local-storage system for the handling of temporary data, but even then it should be done with care and a lot of thought in terms of the long term scalability.

Using the File System

Use the module "fs", visit https://nodejs.org/docs/latest-v13.x/api/fs.html

const fs = require("fs");


Using a database

Use the module that matches the database you want to access, visit https://expressjs.com/en/guide/database-integration.html

var mysql = require('mysql')
var connection = mysql.createConnection({
  host: 'localhost',
  user: 'dbuser',
  password: 's3kreee7',
  database: 'my_db'
})


  • No labels