forked from JonathanWexler/get-programming-with-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes.txt
57 lines (35 loc) · 1.97 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
* connect to Azure Cosmos Emulator
"c:\Program Files\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" /EnableMongoDbEndpoint /DataPath=%LOCALAPPDATA%\CosmosDbEmulator
* mongodb connection string
mongodb://username:password@host:port/database?options...
If the username or password includes the at sign @, colon :, slash /, or the percent sign % character, use percent encoding
/ ----> %2F
@ ----> %40
for Azure Cosmos Emulator connection string
mongodb://localhost:C2y6yDjf5%2FR+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw%2FJw==@localhost:10250/recipe_db?ssl=true
username -----> localhost
password -----> C2y6yDjf5%2FR+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw%2FJw==
-----> / encode as %2F
host -----> localhost
port -----> 10250
database -----> recipe_db
* if there is certificate error when connect to database, use the following options
var options = {
replSet: {
sslValidate: false
}
};
* mongoose connection management
https://mongoosejs.com/docs/connections.html
If initial connection fails, Mongoose will not attempt to reconnect
Error after initial connection was established. Mongoose will attempt to reconnect
mongoose.connect() creates default connection mongoose.connection, it is a pool of socket connections
mongoose.createConnection() creates new connection(a pool of socket connections)
* mongoose model
export a model from "mongoose", the model will be scoped to Mongoose's default connection.
* session
https://stormpath.com/blog/everything-you-ever-wanted-to-know-about-node-dot-js-sessions
https://stormpath.com/blog/where-to-store-your-jwts-cookies-vs-html5-web-storage
* web security
https://www.tutorialspoint.com/security_testing/testing_cross_site_scripting.htm
https://www.tutorialspoint.com/security_testing/cross_site_request_forgery.htm