简体   繁体   中英

load node.js nosql database, display sample data from it on total.js site

I am not very clear on how to use node.js nosql with total.js (both are node.js modules).

  • How do I set up the backend database?
  • How do I programmatically create data from a custom/unessential js script , like a table that would serve for user accounts?
  • Where do I load nosql with total.js (where, maybe debug.js , am I adding code/what is the code)?
  • How can I display on a page view, for example, a username from that database (how do I access the data?)

No matter what your solution, please follow these instructions, or be sure to discuss any change:

  1. mkdir project_folder; cd project_folder
  2. npm init
  3. npm install --save nosql
  4. npm install --save total.js
  5. unzip and install empty_project.zip from total.js's download area on github, but do not overwrite files (npm has fresher files than are packaged and ready to go from github)

total.js contains NoSQL embedded database (you don't have to install NoSQL). Basically you can use (and look into the /app/databases directory):

framework.database('users').insert({ alias: 'Peter' });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM