Skip to content

St. Thomas Aquinas Summa Theologica Research Application

Notifications You must be signed in to change notification settings

conradbm/aquinas-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AquinasDaily

For Development

Install express

npm init -y

npm install --save express

npm install --save-dev @babel/core @babel/node @babel/preset-env

Setup babel ES6 syntax

Create .babelrc file in main backend directory with the following,

{ "presets": ["@babel/preset-env"] }

this gives us modern ES6 syntax using server.js

npx babel-node src/server.js

npm install --save body-parser

npm install --save-dev nodemon

for hot-encoding/refreshing

npx nodemon --exec npx babel-node src/server.js

MongoDB Setup

mkdir -p /data/db

mongod

npm install --save mongodb

For Production (AWS EC2)

Setup instance

  1. Create EC2 Instance

  2. Create Key Pair

  3. SSH in

ssh -i .\aquinas-app-key.pem ec2-user@

  1. Install git

sudo yum install git

  1. Install NPM (https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

. ~/.nvm/nvm.sh

nvm install 12.18.4

npm install -g npm@latest

  1. Install MongoDB (https://docs.mongodb.com/manual/tutorial/install-mongodb-on-amazon/)

sudo nano /etc/yum.repos.d/mongodb-org-4.4.repo

Paste the below into the file

[mongodb-org-4.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/amazon/2/mongodb-org/4.4/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc

Install mongo

sudo yum install -y mongodb-org

Run mongo daemon

sudo service mongod start

mongo

use aquinas-db;

  1. Clone git code

git clone https://github.com/conradbm/aquinas-app

cd aquinas-app/aquinas-backend

npm install

  1. Run the server

npm install -g forever

forever start -c "npm start" .

forever list

  1. Map port 8000 to port 80 on AWS

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000

  1. Go manually to security groups for this EC2 instance and change port 80 to ANYWHERE.

Instructions for inserting data into db

Insert articles data

> var file = cat('.aquinas_new.json');

> use aquinas-db

> var o = JSON.parse(file);

> db.articles.insert(o);

Insert similarities data

> var file = cat('.aquinas_similarity.json');

> use aquinas-db

> var o = JSON.parse(file);

> db.articles.insert(o);

Indexing articles

> db.articles.createIndex({"questionTitle":"text", "articleTitle":"text", "articleObjections":"text", "articleBody":"text", "articleReplyToObjections":"text"});

>db.articles.findOne( { $text: { $search: "Plato" } } );


Collections to construct

History table

use aquinas-db;

db.createCollection("history");

For Domain

https://aws.amazon.com/getting-started/hands-on/get-a-domain/

About

St. Thomas Aquinas Summa Theologica Research Application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published