Lad – The best Node.js framework

Lad – The best Node.js framework

2022-10-31 0 955
Resource Number 47259 Last Updated 2025-02-21
¥ 0USD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

The Lad recommended in this issue is the best Node.js framework, made by former Express TC and Koa team members.

Lad – The best Node.js framework插图

Lad feature

Lad has dozens of features and is very configurable.

Microservices

These microservices are pre-configured for security, performance, and elegant reloads.

  • Webapp server → web.js
  • API server → APi.js
  • Job scheduler → bree.js
  • proxy server → proxy.js

< Back end

  • Redis, session, Flash toast, and schema SweetAlert2 messages (using ioredis that supports Cluster, Sentinel, etc.)
  • Koa based webapp and API server (production using HTTP/2!)
  • Built-in paging (use ctx-paginate)
  • RESTful API with BasicAuth and version control
  • Automated job scheduler with cron and human-readable syntax (supported by Mongoose and Bree)
  • Passport-based authentication and group-based (Unix-like) licensing
  • Stripe inspired error handling
  • Mongoose and MongoDB with universal database plug-ins
  • Email template engine with Nodemailer and local rendering
  • Proxy eliminates the need for an Nginx reverse proxy or Apache virtual host
  • Support for multiple languages via built-in i18n translation (see Configuration)
  • Sitemap generator for simple SEO

< Performance

  • Compression and zero expansion methods
  • Stream-based file upload
  • Elegant reload, close, and reconnect handling
  • List Asset revision
  • Ready Amazon S3 and CloudFront

Start using

Strict support for Mac and Ubuntu-based operating systems (not Windows).

< Requirements

Make sure you have the following software installed on your operating system:

  • Git – see GitHub installation tutorial
  • Node.js (v10+) – Install it on any operating system using nvm
    • nvm needs to run after installation nvm install node
    • It is recommended that you install yarn, which is an alternative to npm
  • MongoDB (v3.x+) :
    • Mac (via brew) brew tap mongodb/brew & & brew install mongodb-community & & brew services start mongodb-community:.
    • Ubuntu:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc) "/ mongo - 3.4 - / - org multiverse" < / span > | sudo tee/etc/apt/sources list. D/mongo - org < span Class = "HLJS - number" > 3.4 < / span >. List
sudo apt-get update
sudo apt-get -y install mongodb-org

Redis (v4.x +):

  • Mac (via brew) : brew install redis & & brew services start redis
  • Ubuntu:
sudo add-apt-repository -y ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get -y install redis-server

Install

npm:

npm install -g lad

yarn:

yarn global add lad

< Usage

Create project

lad new-project
cd new-project

First, try typing npm start(or) on the command line. yarn start This will show you all the scripts you can run.

This start script (and many others) uses nps and nps-utils in the background.

The script accepts an < task> Parameter, and a task all will generate, monitor, and recompile all of the above microservices.

Just open http://localhost:3000 and test!

npm:

npm start all

yarn:

yarn start all

< Debugging

  • DEBUG- Debug using debug output (a widely adopted package in the community for debugging across all Node packages) :
DEBUG=* ... 
  • NODE_DEBUG- Debugs internal modules of a node:
NODE_DEBUG=* ... 
  • MONGOOSE_DEBUG- Debug Mongoose original database operation output:
MONGOOSE_DEBUG=true ... 
  • TRANSPORT_DEBUG- debug Nodemailer transport:
TRANSPORT_DEBUG=true

REDIS_MONITOR- Debug Redis using MONITOR (use @ladjs /redis and pass parameters) : truemonitor

REDIS_MONITOR=true ... 
  • REDIS_FRIENDLY_ERROR_STACK- Debug Redis with friendly error stack messages (see showFriendlyErrorStack option for ioredis)
REDIS_FRIENDLY_ERROR_STACK=true ... 

Configuration

Environment variable

According to Twelve-Factor, we simplified the configuration of the Lad project with the dotenv configuration package named @ladjs/env.

We use the following three packages to manage configuration:

  • dotenv-extended – allows us to use.env in a file called.env.schema
  • mustache – allows us to use the Mustache template language in our configuration files. env.env.defaults
  • dotenv-parse-variables – automatically parses the variable type process.env (e.g., FOO=4 will set process.env.FOO =4 as the Number variable type instead of a String)

The configuration is managed by the following in order of priority:

  • File contents located in config/index.js (read process.env environment variable)
  • Contents of the files in the directory config/environments/ (Setting default values for each environment, for example, you can use NODE_ENV=staging, It will load the config file/environments/staging. Js) < / li >
  • Used to override defaults or set required environment variables (e.g. NODE_ENV=production)
  • Environment configuration in.env
  • Environment Settings in.env.defaults

The priority is the environment profile, the environment variables, and then the.env file.

Basically, if dotenv has detected that it was passed as an environment variable, it will not set the environment variable.

View the contents of the config folder and the default values of.env.defaults.

Continuous integration and code coverage

Here are the simple steps needed to set up SemaphoreCI using Codecov:

  • Go to SemaphoreCI and sign up for a free account
  • After pushing the repository to GitHub, add it as a project to SemaphoreCI
  • Configure your project on SemaphoreCI using the following build Settings:
  • Add your project on Codecov and copy the token to the clipboard
  • Set and add CODECOV_TOKEN as the environment variable for your project to go to SemaphoreCI (using the contents from the clipboard)
  • Run the test build on SemaphoreCI (” rebuild the latest version “) and check to make sure your code coverage report is uploaded correctly on Codecov
  • Make sure your README.md file has properly rendered build status and code coverage tags (if your GitHub repository is private, you’ll need to use different tag links from each provider)

—END—

Open Source license: MIT license

资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free source code Lad – The best Node.js framework https://ictcoder.com/kyym/lad-the-best-node-js-framework.html

Share free open-source source code

Q&A
  • 1, automatic: after taking the photo, click the (download) link to download; 2. Manual: After taking the photo, contact the seller to issue it or contact the official to find the developer to ship.
View details
  • 1, the default transaction cycle of the source code: manual delivery of goods for 1-3 days, and the user payment amount will enter the platform guarantee until the completion of the transaction or 3-7 days can be issued, in case of disputes indefinitely extend the collection amount until the dispute is resolved or refunded!
View details
  • 1. Heptalon will permanently archive the process of trading between the two parties and the snapshots of the traded goods to ensure that the transaction is true, effective and safe! 2, Seven PAWS can not guarantee such as "permanent package update", "permanent technical support" and other similar transactions after the merchant commitment, please identify the buyer; 3, in the source code at the same time there is a website demonstration and picture demonstration, and the site is inconsistent with the diagram, the default according to the diagram as the dispute evaluation basis (except for special statements or agreement); 4, in the absence of "no legitimate basis for refund", the commodity written "once sold, no support for refund" and other similar statements, shall be deemed invalid; 5, before the shooting, the transaction content agreed by the two parties on QQ can also be the basis for dispute judgment (agreement and description of the conflict, the agreement shall prevail); 6, because the chat record can be used as the basis for dispute judgment, so when the two sides contact, only communicate with the other party on the QQ and mobile phone number left on the systemhere, in case the other party does not recognize self-commitment. 7, although the probability of disputes is very small, but be sure to retain such important information as chat records, mobile phone messages, etc., in case of disputes, it is convenient for seven PAWS to intervene in rapid processing.
View details
  • 1. As a third-party intermediary platform, Qichou protects the security of the transaction and the rights and interests of both buyers and sellers according to the transaction contract (commodity description, content agreed before the transaction); 2, non-platform online trading projects, any consequences have nothing to do with mutual site; No matter the seller for any reason to require offline transactions, please contact the management report.
View details

Related Article

make a comment
No comments available at the moment
Official customer service team

To solve your worries - 24 hours online professional service