Skip to content

Commit 87a370d

Browse files
authored
Merge pull request #5 from ModularSoftAU/staging
Implement basic product support, Devotions and Verse of The Day
2 parents 85295b0 + 20ba7bd commit 87a370d

8 files changed

Lines changed: 1359 additions & 0 deletions

File tree

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PORT=8080

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
.env

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: node --experimental-modules --experimental-json-modules --experimental-specifier-resolution=node app.js

app.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import fastify from 'fastify';
2+
import config from "./config.json" assert {type: "json"};
3+
import packageData from './package.json' assert {type: "json"};
4+
import dotenv from 'dotenv';
5+
dotenv.config()
6+
7+
// Site Routes
8+
import siteRoutes from './routes'
9+
10+
//
11+
// Application Boot
12+
//
13+
const buildApp = async () => {
14+
15+
const app = fastify({ logger: config.debug });
16+
17+
try {
18+
app.register((instance, options, next) => {
19+
// Routes
20+
siteRoutes(instance);
21+
next();
22+
});
23+
24+
const port = process.env.PORT;
25+
26+
app.listen({ port: port }, (err) => {
27+
if (err) {
28+
app.log.error(err);
29+
process.exit(1);
30+
}
31+
})
32+
33+
console.log(`\n// ${packageData.name} v.${packageData.version}\nGitHub Repository: ${packageData.homepage}\nCreated By: ${packageData.author}`);
34+
console.log(`API is listening to the port ${process.env.PORT}`);
35+
} catch (error) {
36+
app.log.error(`Unable to start the server:\n${error}`);
37+
}
38+
};
39+
40+
buildApp();
41+
42+
export function removeHtmlEntities(str) {
43+
return str.replace(/“|”/g, '');
44+
}

config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"debug": true
3+
}

0 commit comments

Comments
 (0)