MCPcopy
hub / github.com/parse-community/parse-server / start

Method start

src/ParseServer.ts:150–219  ·  view source on GitHub ↗

* Starts Parse Server as an express app; this promise resolves when Parse Server is ready to accept requests.

()

Source from the content-addressed store, hash-verified

148 */
149
150 async start(): Promise<this> {
151 try {
152 if (this.config.state === 'ok') {
153 return this;
154 }
155 this.config.state = 'starting';
156 Config.put(this.config);
157 const {
158 databaseController,
159 hooksController,
160 cacheController,
161 cloud,
162 security,
163 schema,
164 liveQueryController,
165 } = this.config;
166 try {
167 await databaseController.performInitialization();
168 } catch (e) {
169 if (e.code !== Parse.Error.DUPLICATE_VALUE) {
170 throw e;
171 }
172 }
173 const pushController = await controllers.getPushController(this.config);
174 await hooksController.load();
175 const startupPromises = [this.config.loadMasterKey?.()];
176 if (schema) {
177 startupPromises.push(new DefinedSchemas(schema, this.config).execute());
178 }
179 if (
180 cacheController.adapter?.connect &&
181 typeof cacheController.adapter.connect === 'function'
182 ) {
183 startupPromises.push(cacheController.adapter.connect());
184 }
185 startupPromises.push(liveQueryController.connect());
186 await Promise.all(startupPromises);
187 if (cloud) {
188 addParseCloud();
189 if (typeof cloud === 'function') {
190 await Promise.resolve(cloud(Parse));
191 } else if (typeof cloud === 'string') {
192 let json;
193 if (process.env.npm_package_json) {
194 json = require(process.env.npm_package_json);
195 }
196 if (process.env.npm_package_type === 'module' || json?.type === 'module') {
197 await import(path.resolve(process.cwd(), cloud));
198 } else {
199 require(path.resolve(process.cwd(), cloud));
200 }
201 } else {
202 throw "argument 'cloud' must either be a string or a function";
203 }
204 await new Promise(resolve => setTimeout(resolve, 10));
205 }
206 if (security && security.enableCheck && security.enableCheckLog) {
207 new CheckRunner(security).run();

Callers 2

serverFunction · 0.95
startAppMethod · 0.95

Calls 10

addParseCloudFunction · 0.85
loadMasterKeyMethod · 0.80
executeMethod · 0.80
errorMethod · 0.80
performInitializationMethod · 0.65
cloudFunction · 0.50
putMethod · 0.45
loadMethod · 0.45
connectMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected