简体   繁体   English

使用node.js作为我的服务器,需要设置用户帐户,我应该使用哪个数据库程序?

[英]Using node.js for my server, need to setup user accounts, which database program should I use?

I'm pretty new to the whole node.js thing (as well as servers, javascript and the internet in general). 我对整个node.js事物(以及服务器,javascript和一般的互联网)都很陌生。 I'm setting up a node.js server and I want to be able to create user accounts. 我正在设置node.js服务器,我希望能够创建用户帐户。

Assumption 1: This requires using a database of some sort. 假设1:这需要使用某种数据库。

At first I was going to go with mySQL because it's the first DBMS I could think of and it's open source and there's a node.js module for it. 起初我打算使用mySQL,因为它是我能想到的第一个DBMS,它是开源的,并且有一个node.js模块。 But reading through stack overflow and other sites, everyone is talking about using mongoose, redis and other things. 但阅读堆栈溢出和其他网站,每个人都在谈论使用猫鼬,redis和其他东西。

What should I use? 我该怎么用? Why should I use it? 我为什么要用它? How far away from making sense am I? 离我有多远了?

Redis is a fast key-value store which is great for something like session. Redis是一个快速的键值存储,非常适合会话等。 I see a lot of MongoDB with Mongoose in the community but I am more of a CouchDB person myself. 我在社区中看到很多带有Mongoose的MongoDB,但我自己更像是CouchDB人。

If you like learning new stuff you can try a few of them and see which one you like. 如果你喜欢学习新东西,你可以尝试一些,看看你喜欢哪一个。 If you have a deadline and you know MySql I would just stick with that for now. 如果你有一个截止日期,你知道MySql我会坚持现在。

MongoDB is a good choice. MongoDB是一个不错的选择。 I'm a huge fan of Redis myself (even for a small, everyday DB). 我自己是Redis的忠实粉丝(即使是小型的日常数据库)。

If you don't need an ORM type modeling for your data, I suggest MongoJS or Mongoskin . 如果您不需要对数据进行ORM类型建模,我建议使用MongoJSMongoskin They both make it really easy to interface with MongoDB with very little code. 它们都可以很容易地用很少的代码与MongoDB进行交互。

If this is for a project that you are just building on your local machine for learning, then mongodb with mongoose and mongoose-auth can give you a pretty quick start. 如果这是您刚刚在本地计算机上构建的项目,那么使用mongoosemongoose-auth的 mongodb可以让您快速入门。

If you are planning to deploy this to production somewhere you should find out what your hosting provider offers. 如果您计划将其部署到某个地方的生产环境中,您应该了解您的托管服务提供商提供的内容。 If you have not picked a hosting provider checkout Heroku . 如果您还没有选择托管服务提供商结帐Heroku They offer PostgreSQL and they make it really easy to deploy your app without having to worry about server setup and config, etc. 他们提供PostgreSQL ,它们使您可以轻松部署应用程序,而无需担心服务器设置和配置等。

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

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