What is Express.js?

后端 未结 8 2070
北荒
北荒 2020-12-02 03:42

I am a learner in Node.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 fo
8条回答
  •  [愿得一人]
    2020-12-02 04:03

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

    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).

    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 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.

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

提交回复
热议问题