Express.js 是什么? [英] What is Express.js?

查看:35
本文介绍了Express.js 是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Node.js 的学习者.

  1. 什么是 Express.js?
  2. 使用 Node.js 的目的是什么?
  3. 为什么我们实际上需要 Express.js?与 Node.js 一起使用对我们有什么用处?
  4. 什么是 Redis?它是否与 Express.js 一起提供?
  1. What's Express.js?
  2. What's the purpose of it with Node.js?
  3. Why do we actually need Express.js? How is it useful for us to use with Node.js?
  4. What's Redis? Does it come with Express.js?

推荐答案

这已经过于简化了,但是 Express.jsNode.js 什么 Ruby on RailsSinatraRuby.

This is over simplifying it, but Express.js is to Node.js what Ruby on Rails or Sinatra is to Ruby.

Express 3.x 是一个轻量级的 Web 应用程序框架,可帮助将您的 Web 应用程序组织到服务器端的 MVC 架构中.您可以为模板语言使用多种选择(例如 EJSJadeDust.js).

Express 3.x is a light-weight web application framework to help organize your web application into an MVC architecture on the server side. You can use a variety of choices for your templating language (like EJS, Jade, and Dust.js).

然后您可以使用MongoDB之类的数据库和Mongoose(用于建模)为您的 Node.js 应用程序提供后端.Express.js 基本上可以帮助您管理一切,从路由到处理请求和视图.

You can then use a database like MongoDB with Mongoose (for modeling) to provide a backend for your Node.js application. Express.js basically helps you manage everything, from routes, to handling requests and views.

Redis 是一种键/值存储——通常用于 Node.js 应用程序中的会话和缓存.你可以用它做更多的事情,但这就是我用它的目的.我将 MongoDB 用于更复杂的关系,例如 line-item <-> order <-> 用户关系.有一些模块(最著名的是 connect-redis)可以与 Express.js 一起使用.您需要在服务器上安装 Redis 数据库.

Redis is a key/value store -- commonly used for sessions and caching in Node.js applications. You can do a lot more with it, but that's what I'm using it for. I use MongoDB for more complex relationships, like line-item <-> order <-> user relationships. There are modules (most notably connect-redis) that will work with Express.js. You will need to install the Redis database on your server.

这是 Express 3.x 指南的链接:https://expressjs.com/zh/3x/api.html

Here is a link to the Express 3.x guide: https://expressjs.com/en/3x/api.html

这篇关于Express.js 是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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