是否可以将javascript存储在数据库中? [英] Is it possible to store javascript in a database?

查看:175
本文介绍了是否可以将javascript存储在数据库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web应用程序的想法,用户可以提交Javascript代码,然后将其提供给其他用户。我想知道什么是最好的方法是否可以将Javascript存储在数据库中,然后根据用户的请求将其提供给用户?我还希望能够将元数据附加到每段代码上:名称,用户等级等,因此对于我有些不了解的人来说,数据库似乎是自然的解决方案。我正在使用MongoDB在后端上使用Rails。

I have an idea for a web application where a user can submit Javascript code that can then be served up to other users. I'm wondering what's the best way of going about this. Is it possible to store the Javascript in a database and then serve it up to users as they request it? I would also like to be able to attach metadata to each piece of code: name, user ratings, etc., so a database seems like the natural solution to my somewhat underinformed mind. I'm looking at using Rails on the backend with MongoDB.

推荐答案

Javascript是文本字符串。数据库可以存储文本字符串。因此,数据库可以存储Javascript。

Javascript is a string of text. Databases can store strings of text. Hence, databases can store Javascript.

除非您有一些我想念的具体想法,否则,我完全同意@Aircule的观点。 / p>

Unless you have some specific idea I'm missing though, I wholly agree with @Aircule's sentiment.


哇,我认为我没有看到一个更糟的想法了。

Wow, I don't think I've seen a worse idea in ages.

这篇关于是否可以将javascript存储在数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆