我可以创建一个简单的网站来接受输入和显示,没有Rails,数据库或外部Web服务器吗?

时间:2022-07-04 17:31:50

I am trying to see if I can create a simple website, like a blog, using only Ruby. No Rails or a database or outside web servers. I plan to store the data in a file for persistence.

我试图看看我是否可以使用Ruby创建一个简单的网站,比如博客。没有Rails或数据库或外部Web服务器。我计划将数据存储在文件中以保持持久性。

I wanted to use TCPServer, CGI, and Net::HTTP.

我想使用TCPServer,CGI和Net :: HTTP。

Is there an easier way I can use?

有更简单的方法可以使用吗?

2 个解决方案

#1


3  

There are a lot of moving parts when designing a website.

设计网站时有很多活动部分。

Depending on the purpose of the exercise, you might want to consider using a very simple web framework like Camping, Sinatra, or Ramaze. This is probably the best solution if you're trying to get a top level understanding of web programming because it only has exactly what you need (Camping is less than 4k!) and handles stuff like routing.

根据练习的目的,您可能需要考虑使用非常简单的Web框架,如Camping,Sinatra或Ramaze。如果你想要对网络编程有一个*的理解,这可能是最好的解决方案,因为它只有你所需要的(露营不到4k!)并处理像路由这样的东西。

Building a web server is more an exercise in HTTP parsing. You might want to omit the framework and try to build something on top of Rake (an API for lots of popular web servers) and a simple web server like Webrick or Thin.

构建Web服务器更像是HTTP解析的一个练习。您可能希望省略框架并尝试在Rake(许多流行的Web服务器的API)和简单的Web服务器(如Webrick或Thin)之上构建一些东西。

#2


0  

You could also try Espresso

你也可以试试Espresso

It is easy to learn and fast to run.

它易于学习和快速运行。

And offers all the liberty you need for creation process.

并提供创作过程所需的所有*。

Also it has no hidden "fees", everything is transparent.

它也没有隐藏的“费用”,一切都是透明的。

#1


3  

There are a lot of moving parts when designing a website.

设计网站时有很多活动部分。

Depending on the purpose of the exercise, you might want to consider using a very simple web framework like Camping, Sinatra, or Ramaze. This is probably the best solution if you're trying to get a top level understanding of web programming because it only has exactly what you need (Camping is less than 4k!) and handles stuff like routing.

根据练习的目的,您可能需要考虑使用非常简单的Web框架,如Camping,Sinatra或Ramaze。如果你想要对网络编程有一个*的理解,这可能是最好的解决方案,因为它只有你所需要的(露营不到4k!)并处理像路由这样的东西。

Building a web server is more an exercise in HTTP parsing. You might want to omit the framework and try to build something on top of Rake (an API for lots of popular web servers) and a simple web server like Webrick or Thin.

构建Web服务器更像是HTTP解析的一个练习。您可能希望省略框架并尝试在Rake(许多流行的Web服务器的API)和简单的Web服务器(如Webrick或Thin)之上构建一些东西。

#2


0  

You could also try Espresso

你也可以试试Espresso

It is easy to learn and fast to run.

它易于学习和快速运行。

And offers all the liberty you need for creation process.

并提供创作过程所需的所有*。

Also it has no hidden "fees", everything is transparent.

它也没有隐藏的“费用”,一切都是透明的。