express-sweet 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -457
- package/README.md +2107 -23
- package/configuration_sample/cjs/authentication.js +103 -0
- package/configuration_sample/cjs/config.js +76 -0
- package/configuration_sample/cjs/database.js +35 -0
- package/configuration_sample/cjs/view.js +36 -0
- package/configuration_sample/esm/authentication.js +103 -0
- package/configuration_sample/esm/config.js +76 -0
- package/configuration_sample/esm/database.js +35 -0
- package/configuration_sample/esm/view.js +36 -0
- package/dist/build.cjs +151 -0
- package/dist/build.mjs +151 -0
- package/package.json +27 -29
- package/screencaps/belongs-to-many.png +0 -0
- package/screencaps/belongs-to.png +0 -0
- package/screencaps/demonstration.webp +0 -0
- package/screencaps/has-many.png +0 -0
- package/screencaps/has-one.png +0 -0
- package/types/database/Database.d.ts +3 -171
- package/types/database/Model.d.ts +9 -6
- package/types/database/loadModels.d.ts +3 -1
- package/types/handlebars_helpers/comparison.d.ts +58 -188
- package/types/handlebars_helpers/date.d.ts +1 -1
- package/types/handlebars_helpers/html.d.ts +1 -1
- package/types/handlebars_helpers/index.d.ts +1 -0
- package/types/handlebars_helpers/layouts.d.ts +21 -0
- package/types/handlebars_helpers/math.d.ts +7 -14
- package/types/handlebars_helpers/number.d.ts +1 -1
- package/types/handlebars_helpers/object.d.ts +4 -4
- package/types/handlebars_helpers/string.d.ts +4 -9
- package/types/index.d.ts +0 -1
- package/types/interfaces/AuthenticationConfig.d.ts +0 -5
- package/types/interfaces/BasicConfig.d.ts +1 -5
- package/types/interfaces/ViewConfig.d.ts +0 -2
- package/types/middlewares/Authentication.d.ts +3 -1
- package/types/middlewares/CORS.d.ts +3 -1
- package/types/middlewares/Environment.d.ts +3 -3
- package/types/middlewares/ErrorHandler.d.ts +3 -1
- package/types/middlewares/Http.d.ts +3 -1
- package/types/middlewares/Local.d.ts +3 -1
- package/types/middlewares/View.d.ts +6 -2
- package/types/mount.d.ts +4 -2
- package/types/routing/Router.d.ts +3 -1
- package/types/services/Authentication.d.ts +4 -3
- package/types/types/global.d.ts +17 -0
- package/types/utils/loadAuthenticationConfig.d.ts +2 -2
- package/types/utils/loadBasicConfig.d.ts +2 -2
- package/types/utils/loadDatabaseConfig.d.ts +2 -2
- package/types/utils/loadViewConfig.d.ts +2 -2
- package/INSTALL-Redis.md +0 -77
- package/QUICK_START.md +0 -149
- package/dist/build.common.js +0 -378
- package/dist/build.esm.js +0 -378
- package/screencaps/login.jpg +0 -0
- package/screencaps/personal.jpg +0 -0
- package/screencaps/user-editing.jpg +0 -0
- package/screencaps/users.jpg +0 -0
- package/types/exceptions/FaceCollectionCreateFailed.d.ts +0 -25
- package/types/exceptions/FaceCollectionDeleteFailed.d.ts +0 -25
- package/types/exceptions/FaceIndexFailed.d.ts +0 -20
- package/types/exceptions/FaceMissingInPhoto.d.ts +0 -11
- package/types/exceptions/FacesMultipleInPhoto.d.ts +0 -11
- package/types/exceptions/index.d.ts +0 -5
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Read the environment variable file in options.path and set it in "process.env".
|
|
2
|
+
* Mount environment variables. Read the environment variable file in options.path and set it in "process.env".
|
|
4
3
|
*/
|
|
5
4
|
export default class {
|
|
6
5
|
/**
|
|
7
6
|
* Mount on application.
|
|
7
|
+
* @return {Promise<void>}
|
|
8
8
|
*/
|
|
9
|
-
static mount(): void
|
|
9
|
+
static mount(): Promise<void>;
|
|
10
10
|
}
|
|
@@ -5,6 +5,8 @@ import express from 'express';
|
|
|
5
5
|
export default class {
|
|
6
6
|
/**
|
|
7
7
|
* Mount on application.
|
|
8
|
+
* @param {express.Express} app Express application instance.
|
|
9
|
+
* @return {Promise<void>}
|
|
8
10
|
*/
|
|
9
|
-
static mount(app: express.Express): void
|
|
11
|
+
static mount(app: express.Express): Promise<void>;
|
|
10
12
|
}
|
|
@@ -5,6 +5,8 @@ import express from 'express';
|
|
|
5
5
|
export default class {
|
|
6
6
|
/**
|
|
7
7
|
* Mount on application.
|
|
8
|
+
* @param {express.Express} app Express application instance.
|
|
9
|
+
* @return {Promise<void>}
|
|
8
10
|
*/
|
|
9
|
-
static mount(app: express.Express): void
|
|
11
|
+
static mount(app: express.Express): Promise<void>;
|
|
10
12
|
}
|
|
@@ -8,6 +8,8 @@ import express from 'express';
|
|
|
8
8
|
export default class {
|
|
9
9
|
/**
|
|
10
10
|
* Mount on application.
|
|
11
|
+
* @param {express.Express} app Express application instance.
|
|
12
|
+
* @return {Promise<void>}
|
|
11
13
|
*/
|
|
12
|
-
static mount(app: express.Express): void
|
|
14
|
+
static mount(app: express.Express): Promise<void>;
|
|
13
15
|
}
|
|
@@ -5,10 +5,14 @@ import express from 'express';
|
|
|
5
5
|
export default class {
|
|
6
6
|
/**
|
|
7
7
|
* Mount on application.
|
|
8
|
+
* @param {express.Express} app Express application instance.
|
|
9
|
+
* @return {Promise<void>}
|
|
8
10
|
*/
|
|
9
|
-
static mount(app: express.Express): void
|
|
11
|
+
static mount(app: express.Express): Promise<void>;
|
|
10
12
|
/**
|
|
11
13
|
* Mount middleware to be executed just before drawing the view.
|
|
14
|
+
* @param {express.Express} app Express application instance.
|
|
15
|
+
* @return {Promise<void>}
|
|
12
16
|
*/
|
|
13
|
-
static mountBeforeRender(app: express.Express): void
|
|
17
|
+
static mountBeforeRender(app: express.Express): Promise<void>;
|
|
14
18
|
}
|
package/types/mount.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
/**
|
|
3
3
|
* Mount extensions on your application.
|
|
4
|
-
* @param {express.Express} app Express application instance
|
|
4
|
+
* @param {express.Express} app Express application instance.
|
|
5
|
+
* @return {Promise<void>}
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
+
declare const _default: (app: express.Express) => Promise<void>;
|
|
8
|
+
export default _default;
|
|
@@ -7,6 +7,8 @@ import express from 'express';
|
|
|
7
7
|
export default class {
|
|
8
8
|
/**
|
|
9
9
|
* Mount on application.
|
|
10
|
+
* @param {express.Express} app Express application instance.
|
|
11
|
+
* @return {Promise<void>}
|
|
10
12
|
*/
|
|
11
|
-
static mount(app: express.Express): void
|
|
13
|
+
static mount(app: express.Express): Promise<void>;
|
|
12
14
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="cookie-parser" />
|
|
2
1
|
import express from 'express';
|
|
3
2
|
/**
|
|
4
3
|
* User authentication service.
|
|
@@ -20,12 +19,14 @@ export default class {
|
|
|
20
19
|
/**
|
|
21
20
|
* Redirects to the page that responds immediately after successful authentication set in "success_redirect" of "config/authentication.js".
|
|
22
21
|
* @param {express.Response} res The res object represents the HTTP response that an Express app sends when it gets an HTTP request.
|
|
22
|
+
* @return {Promise<void>}
|
|
23
23
|
*/
|
|
24
|
-
static successRedirect(res: express.Response): void
|
|
24
|
+
static successRedirect(res: express.Response): Promise<void>;
|
|
25
25
|
/**
|
|
26
26
|
* Redirects to the page that responds immediately after authentication failure set in "failure_redirect" of "config/authentication.js".
|
|
27
27
|
* @param {express.Request} req The req object represents the HTTP request and has properties for the request query string, parameters, body, HTTP headers, and so on.
|
|
28
28
|
* @param {express.Response} res The res object represents the HTTP response that an Express app sends when it gets an HTTP request.
|
|
29
|
+
* @return {Promise<void>}
|
|
29
30
|
*/
|
|
30
|
-
static failureRedirect(req: express.Request, res: express.Response): void
|
|
31
|
+
static failureRedirect(req: express.Request, res: express.Response): Promise<void>;
|
|
31
32
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extend a Global object.
|
|
3
|
+
*/
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Application root directory.
|
|
7
|
+
* @type {string}
|
|
8
|
+
*/
|
|
9
|
+
var APP_DIR: string;
|
|
10
|
+
/**
|
|
11
|
+
* Flag to prevent multiple loading of env.
|
|
12
|
+
* True if env has already been loaded.
|
|
13
|
+
* @type {boolean}
|
|
14
|
+
*/
|
|
15
|
+
var loadedEnv: boolean;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AuthenticationConfig from '~/interfaces/AuthenticationConfig';
|
|
2
2
|
/**
|
|
3
3
|
* Get Authentication configuration (config/authentication).
|
|
4
|
-
* @return {AuthenticationConfig} Loaded configuration.
|
|
4
|
+
* @return {Promise<AuthenticationConfig>} Loaded configuration.
|
|
5
5
|
*/
|
|
6
|
-
declare const _default: () => AuthenticationConfig
|
|
6
|
+
declare const _default: () => Promise<AuthenticationConfig>;
|
|
7
7
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import BasicConfig from '~/interfaces/BasicConfig';
|
|
2
2
|
/**
|
|
3
3
|
* Get basic configuration (config/config).
|
|
4
|
-
* @return {BasicConfig} Loaded configuration.
|
|
4
|
+
* @return {Promise<BasicConfig>} Loaded configuration.
|
|
5
5
|
*/
|
|
6
|
-
declare const _default: () => BasicConfig
|
|
6
|
+
declare const _default: () => Promise<BasicConfig>;
|
|
7
7
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import sequelize from 'sequelize';
|
|
2
2
|
/**
|
|
3
3
|
* Get database configuration (config/database).
|
|
4
|
-
* @return {sequelize.Options} Loaded configuration.
|
|
4
|
+
* @return {Promise<sequelize.Options>} Loaded configuration.
|
|
5
5
|
*/
|
|
6
|
-
declare const _default: () => sequelize.Options
|
|
6
|
+
declare const _default: () => Promise<sequelize.Options>;
|
|
7
7
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ViewConfig from '~/interfaces/ViewConfig';
|
|
2
2
|
/**
|
|
3
3
|
* Get view configuration (config/view).
|
|
4
|
-
* @return {ViewConfig} Loaded configuration.
|
|
4
|
+
* @return {Promise<ViewConfig>} Loaded configuration.
|
|
5
5
|
*/
|
|
6
|
-
declare const _default: () => ViewConfig
|
|
6
|
+
declare const _default: () => Promise<ViewConfig>;
|
|
7
7
|
export default _default;
|
package/INSTALL-Redis.md
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# Install Redis
|
|
2
|
-
==============
|
|
3
|
-
|
|
4
|
-
## Environment for this procedure
|
|
5
|
-
* OS: `Amazon Linux 2`
|
|
6
|
-
* Redis: `v6.2.6 or later`
|
|
7
|
-
* see more: https://redis.io/download#installation
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Install Redis
|
|
11
|
-
1. Check the version of Redis that can be installed.
|
|
12
|
-
```sh
|
|
13
|
-
amazon-linux-extras list|grep redis
|
|
14
|
-
# Below is an example of the output.
|
|
15
|
-
# 56 redis6 available [ =stable ]
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
1. Install Redis by specifying the version.
|
|
19
|
-
```sh
|
|
20
|
-
sudo amazon-linux-extras install -y redis6
|
|
21
|
-
```
|
|
22
|
-
1. Configure and start Redis autostart.
|
|
23
|
-
```sh
|
|
24
|
-
sudo systemctl status redis.service
|
|
25
|
-
sudo systemctl start redis.service
|
|
26
|
-
sudo systemctl enable redis.service
|
|
27
|
-
sudo systemctl is-enabled redis.service
|
|
28
|
-
```
|
|
29
|
-
1. Check Redis process.
|
|
30
|
-
```sh
|
|
31
|
-
ps -ef | grep redis | grep -v grep
|
|
32
|
-
# Below is an example of the output.
|
|
33
|
-
# redis 5407 1 0 11:02 ? 00:00:00 /usr/bin/redis-server 127.0.0.1:6379
|
|
34
|
-
```
|
|
35
|
-
1. Check Redis behavior. If "redis-cli ping" returns PONG, it is success.
|
|
36
|
-
```sh
|
|
37
|
-
redis-cli ping
|
|
38
|
-
# Below is an example of the output.
|
|
39
|
-
# PONG
|
|
40
|
-
```
|
|
41
|
-
1. Test Redis read/write.
|
|
42
|
-
```sh
|
|
43
|
-
redis-cli
|
|
44
|
-
|
|
45
|
-
set myMessage "hello world"
|
|
46
|
-
# OK
|
|
47
|
-
|
|
48
|
-
get myMessage
|
|
49
|
-
# "hello world"
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Commonly used Redis commands
|
|
53
|
-
- Start Redis CLI
|
|
54
|
-
```sh
|
|
55
|
-
redis-cli
|
|
56
|
-
```
|
|
57
|
-
- Key List
|
|
58
|
-
```sh
|
|
59
|
-
redis-cli --raw keys \*
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
or
|
|
63
|
-
```sh
|
|
64
|
-
redis-cli --scan
|
|
65
|
-
```
|
|
66
|
-
- Value List
|
|
67
|
-
```sh
|
|
68
|
-
redis-cli --raw mget $(redis-cli --scan)
|
|
69
|
-
```
|
|
70
|
-
- Key and Value List
|
|
71
|
-
```sh
|
|
72
|
-
for i in $(redis-cli keys \*); do echo $i: $(redis-cli GET $i); done
|
|
73
|
-
```
|
|
74
|
-
- Delete key
|
|
75
|
-
```sh
|
|
76
|
-
redis-cli del myMessage
|
|
77
|
-
```
|
package/QUICK_START.md
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
# Quick Start
|
|
2
|
-
|
|
3
|
-
The easiest way to get started with Express Sweet is to install express-sweet-generator and automatically create a template application.
|
|
4
|
-
The following application can be started immediately by executing the template.
|
|
5
|
-
See <a href="https://takuya-motoshima.github.io/express-sweet/v2/" target="_blank">here</a> for instructions on using express-sweet.
|
|
6
|
-
|
|
7
|
-
<p align="center">
|
|
8
|
-
<img alt="login" src="screencaps/login.jpg" width="45%">
|
|
9
|
-
<img alt="users" src="screencaps/users.jpg" width="45%">
|
|
10
|
-
</p>
|
|
11
|
-
<p align="center">
|
|
12
|
-
<img alt="user-editing" src="screencaps/user-editing.jpg" width="45%">
|
|
13
|
-
<img alt="personal" src="screencaps/personal.jpg" width="45%">
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
1. Use the application generator tool, express-sweet-generator, to quickly create an application skeleton.
|
|
17
|
-
```sh
|
|
18
|
-
npm install -g express-sweet-generator
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
1. Create an Express myapp named myapp.
|
|
22
|
-
The app is created in a folder named myapp in the working directory.
|
|
23
|
-
```sh
|
|
24
|
-
express-sweet myapp
|
|
25
|
-
# If you want to use ESM, below.
|
|
26
|
-
#express-sweet -o esm myapp
|
|
27
|
-
```
|
|
28
|
-
1. Install dependent packages.
|
|
29
|
-
```sh
|
|
30
|
-
cd myapp
|
|
31
|
-
npm install
|
|
32
|
-
```
|
|
33
|
-
1. This sample application uses a database.
|
|
34
|
-
Execute the following SQL to create the database.
|
|
35
|
-
```sql
|
|
36
|
-
CREATE DATABASE IF NOT EXISTS `express_sweet_db` DEFAULT CHARACTER SET utf8mb4;
|
|
37
|
-
|
|
38
|
-
USE `express_sweet_db`;
|
|
39
|
-
|
|
40
|
-
CREATE TABLE `user` (
|
|
41
|
-
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
42
|
-
`name` varchar(30) NOT NULL,
|
|
43
|
-
`email` varchar(255) NOT NULL,
|
|
44
|
-
`password` varchar(100) NOT NULL,
|
|
45
|
-
`icon` varchar(768) NOT NULL DEFAULT MD5(RAND()),
|
|
46
|
-
`created` datetime NOT NULL DEFAULT current_timestamp(),
|
|
47
|
-
`modified` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
|
48
|
-
PRIMARY KEY (`id`),
|
|
49
|
-
UNIQUE KEY `ukUserEmail` (`email`),
|
|
50
|
-
UNIQUE KEY `ukUserIcon`(`icon`)
|
|
51
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
52
|
-
|
|
53
|
-
CREATE TABLE `profile` (
|
|
54
|
-
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
55
|
-
`userId` int(10) unsigned NOT NULL,
|
|
56
|
-
`address` varchar(255) NOT NULL,
|
|
57
|
-
`tel` varchar(14) NOT NULL,
|
|
58
|
-
`created` datetime NOT NULL DEFAULT current_timestamp(),
|
|
59
|
-
`modified` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
|
60
|
-
PRIMARY KEY (`id`),
|
|
61
|
-
UNIQUE KEY `ukProfileUserId` (`userId`),
|
|
62
|
-
CONSTRAINT `fkProfileUser` FOREIGN KEY (`userId`) REFERENCES `user` (`id`)
|
|
63
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
64
|
-
|
|
65
|
-
CREATE TABLE `comment` (
|
|
66
|
-
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
67
|
-
`userId` int(10) unsigned NOT NULL,
|
|
68
|
-
`text` text NOT NULL,
|
|
69
|
-
`created` datetime NOT NULL DEFAULT current_timestamp(),
|
|
70
|
-
`modified` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
|
71
|
-
PRIMARY KEY (`id`),
|
|
72
|
-
CONSTRAINT `fkCommentUser` FOREIGN KEY (`userId`) REFERENCES `user` (`id`)
|
|
73
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
74
|
-
|
|
75
|
-
CREATE TABLE `book` (
|
|
76
|
-
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
77
|
-
`userId` int(10) unsigned NOT NULL,
|
|
78
|
-
`title` text NOT NULL,
|
|
79
|
-
`created` datetime NOT NULL DEFAULT current_timestamp(),
|
|
80
|
-
`modified` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
|
81
|
-
PRIMARY KEY (`id`),
|
|
82
|
-
UNIQUE KEY `ukBookTitle` (`userId`, `title`(255)),
|
|
83
|
-
CONSTRAINT `fkBookUser` FOREIGN KEY (`userId`) REFERENCES `user` (`id`)
|
|
84
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
85
|
-
|
|
86
|
-
INSERT INTO `user` (`id`, `email`, `password`, `name`, `icon`) VALUES
|
|
87
|
-
(1, 'robin@example.com', 'password', 'Robin', '/upload/1.png'),
|
|
88
|
-
(2, 'taylor@example.com', 'password', 'Taylor', '/upload/2.png');
|
|
89
|
-
|
|
90
|
-
INSERT INTO `profile` (`userId`, `address`, `tel`) VALUES
|
|
91
|
-
(1, '777 Brockton Avenue, Abington MA 2351', '202-555-0105'),
|
|
92
|
-
(2, '30 Memorial Drive, Avon MA 2322', '');
|
|
93
|
-
|
|
94
|
-
INSERT INTO `comment` (`userId`, `text`) VALUES
|
|
95
|
-
(1, 'From Robin #1'),
|
|
96
|
-
(1, 'From Robin #2'),
|
|
97
|
-
(2, 'From Taylor #1');
|
|
98
|
-
|
|
99
|
-
INSERT INTO `book` (`userId`, `title`) VALUES
|
|
100
|
-
(1, 'Beautiful'),
|
|
101
|
-
(1, 'Lose Yourself'),
|
|
102
|
-
(2, 'When Im Gone');
|
|
103
|
-
```
|
|
104
|
-
1. Build front-end JS.
|
|
105
|
-
```sh
|
|
106
|
-
cd myapp/client
|
|
107
|
-
npm install
|
|
108
|
-
npm run build
|
|
109
|
-
```
|
|
110
|
-
1. Next, you need to set how the database is connected.
|
|
111
|
-
The database connection method can be set in config/database.js, so change it according to your environment.
|
|
112
|
-
See [here](https://sequelize.org/docs/v6/other-topics/migrations/#cfg) for details.
|
|
113
|
-
```js
|
|
114
|
-
// For ESM, use "export default".
|
|
115
|
-
//export default {
|
|
116
|
-
module.exports = {
|
|
117
|
-
development: {
|
|
118
|
-
username: 'root',
|
|
119
|
-
password: 'password',
|
|
120
|
-
database: 'express_sweet_db',
|
|
121
|
-
host: 'localhost',
|
|
122
|
-
dialect: 'mariadb'
|
|
123
|
-
},
|
|
124
|
-
test: {
|
|
125
|
-
username: 'root',
|
|
126
|
-
password: 'password',
|
|
127
|
-
database: 'express_sweet_db',
|
|
128
|
-
host: 'localhost',
|
|
129
|
-
dialect: 'mariadb'
|
|
130
|
-
},
|
|
131
|
-
production: {
|
|
132
|
-
username: 'root',
|
|
133
|
-
password: 'password',
|
|
134
|
-
database: 'express_sweet_db',
|
|
135
|
-
host: 'localhost',
|
|
136
|
-
dialect: 'mariadb'
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
```
|
|
140
|
-
1. The DB to be used can be defined individually for each environment.
|
|
141
|
-
Specify the environment in the .env file.
|
|
142
|
-
```js
|
|
143
|
-
NODE_ENV=development
|
|
144
|
-
```
|
|
145
|
-
1. Launch the application.
|
|
146
|
-
```sh
|
|
147
|
-
cd myapp
|
|
148
|
-
npm start
|
|
149
|
-
```
|