Node learning notes optimization crud addition, deletion, modification and query
This article combines the previous< Node learning notes Mongodb and Mongoose >Yes curd example Optimize
MongoDB installation
Download address of installation file:[ https://www.mongodb.com/download-center/community]
To install MongoDB on Windows: https://www.runoob.com/mongodb/mongodb-window-install.html
Special attention should be paid d ...
Posted by bashaash on Wed, 18 Dec 2019 14:12:30 -0800
Replace node JS express view engine jade with html
The default view engine generated by express project is jade. At that time, I preferred html pages in development, so this article introduces how to replace the default view engine jade of express with html
Step 1: open the app.js file of the project. The contents of the app.js are as follows:
var createError = require('http- ...
Posted by seanrock on Sun, 01 Dec 2019 08:23:54 -0800
Query in mongoose
find()
Model.find(filter[, projection][, options][, callback])
Parameter 1: filter
The query condition uses the format of JSON document, and the syntax of JSON document follows MongoDB shell The same is true.
{ field1: value1, field2: { operator: value2 } ... }
1. Find all
Model.find()
Model.find({})
2. Accurate search
Model.find({author:'dora' ...
Posted by lplatz on Thu, 14 Nov 2019 22:29:05 -0800
Forum and background built with node+mongodb
Forum and background built with node+mongodb
This is the first project background that I have done. If there are any inappropriateness and correction, please give me more advice. This project is only for reference! Thank you.
I put the source code at the bottom of the article. If you need it, you can ...
Posted by curb on Sun, 27 Oct 2019 05:23:53 -0700
Notes on node.js+mongodb+express to realize simple version of blog management system
I. Case initialization
Related folders
public: static resources
model: database related files
Route: route
views: template files
Build project description file
npm init -y
Download third party module
npm i express mongoose art-template express-art-template
Create server
const express = require ...
Posted by richo89 on Sat, 26 Oct 2019 00:26:17 -0700
mongodb / morgan save log
Save logs in log files
// app.js
var logger = require('morgan');
var fs = require('fs')
var logDirectory = path.join(__dirname, 'log')
fs.existsSync(logDirectory) || fs.mkdirSync(logDirectory)
var accesLogStream = FileStreamRotator.getStream({
date_format: 'YYYYMMDD',
filename: path.join(logDirectory, 'access-%DATE%.log'),
frequency: 'dai ...
Posted by newjsguy on Fri, 30 Aug 2019 21:54:39 -0700
How can I quickly set up a short-link service?
Summary: A simple short-link tutorial.
Original: Ten minutes for short-link service (Node + Express + MongoDB)
Author: MudOnTire
Fundebug Copyright shall be owned by the original author when authorized to reproduce.
We have used short links more or less. The so-called short links are short links generated from the long original link url. Vis ...
Posted by stride-r on Thu, 22 Aug 2019 19:01:35 -0700
Using session within the express framework
The last article mentioned the shortcomings of cookie s and suggested that session is one way to solve the shortcomings.This article tells you how to use session. The author used the file save session method.If you don't want to save in memory or database, remember to use the appropriate module. Below are two ways to use memory storage and fil ...
Posted by citricsquid on Tue, 30 Jul 2019 09:24:20 -0700
Talking about iOS Hot Repair Architecture Downgradable
Router is really a very good design pattern, which can achieve ultra-low coupling. As the last section of the series, we will coordinate the three ends to achieve a hot repair architecture. Next, the definition of this architecture is that when the business logic of the Native page appears Bug, it can not be packed online immediately to pass th ...
Posted by macmonkey on Tue, 09 Jul 2019 11:35:11 -0700
Build a Restful back end in 5 minutes
Raw material
express
mongoose
seven-express
express-session
Start
Using npm to install express and scaffolding
$ npm install -g --save express express-generator
Initialization project
The default is to use the Jade template, and you can use -- view=== to specify other templates.
$ express seven-test
$ cd seven-test
$ npm install
$ npm in ...
Posted by Franko126 on Sat, 06 Jul 2019 11:18:05 -0700