-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
45 lines (39 loc) · 1.34 KB
/
server.js
File metadata and controls
45 lines (39 loc) · 1.34 KB
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
'use strict';
/*
|--------------------------------------------------------------------------
| Http server
|--------------------------------------------------------------------------
|
| This file bootstrap Adonisjs to start the HTTP server. You are free to
| customize the process of booting the http server.
|
| """ Loading ace commands """
| At times you may want to load ace commands when starting the HTTP server.
| Same can be done by chaining `loadCommands()` method after
|
| """ Preloading files """
| Also you can preload files by calling `preLoad('path/to/file')` method.
| Make sure to pass relative path from the project root.
*/
//node version < 15
if (!String.prototype.replaceAll) {
String.prototype.replaceAll = function (str, newStr) {
// If a regex pattern
if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') {
return this.replace(str, newStr);
}
// If a string
return this.split(str).join(newStr);
};
}
const fs = require('fs');
try {
if (!fs.existsSync('.env') && fs.existsSync('.env.example')) {
var data = fs.readFileSync('.env.example');
fs.writeFileSync('.env', data);
}
} catch (err) {
console.error(err);
}
const { Ignitor } = require('@adonisjs/ignitor');
new Ignitor(require('@adonisjs/fold')).appRoot(__dirname).fireHttpServer().catch(console.error);