简体   繁体   English

加载node.js nosql数据库,在total.js网站上显示来自该数据库的样本数据

[英]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). 我不太清楚如何将node.js nosql与total.js(都是node.js模块)一起使用。

  • 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? 如何以编程方式从自定义/必要的js脚本创建数据,例如可用于用户帐户的表?
  • Where do I load nosql with total.js (where, maybe debug.js , am I adding code/what is the code)? 我在哪里用total.js加载nosql(在哪里,可能是debug.js ,我要添加代码/代码是什么)?
  • 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) 从github上total.js的下载区域解压缩并安装empty_project.zip,但不要覆盖文件(npm的文件比打包的要新鲜,可以从github上下载)

total.js contains NoSQL embedded database (you don't have to install NoSQL). total.js包含NoSQL嵌入式数据库 (您不必安装NoSQL)。 Basically you can use (and look into the /app/databases directory): 基本上,您可以使用(并查看/app/databases目录):

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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