backend working

This commit is contained in:
Guy Bianco IV 2021-06-14 16:38:51 -04:00
parent 51e096f605
commit 02a68db12b
7 changed files with 37 additions and 39 deletions

View file

@ -2878,9 +2878,9 @@
} }
}, },
"node_modules/normalize-url": { "node_modules/normalize-url": {
"version": "4.5.0", "version": "4.5.1",
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz",
"integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=8" "node": ">=8"
@ -6461,9 +6461,9 @@
"dev": true "dev": true
}, },
"normalize-url": { "normalize-url": {
"version": "4.5.0", "version": "4.5.1",
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz",
"integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==",
"dev": true "dev": true
}, },
"object-assign": { "object-assign": {

View file

@ -1,5 +1,5 @@
import cookieParser from "cookie-parser"; import cookieParser from "cookie-parser";
import express, { Request, Response } from "express"; import express from "express";
import "express-async-errors"; import "express-async-errors";
import cors from "cors"; import cors from "cors";
import { Sequelize } from "sequelize"; import { Sequelize } from "sequelize";
@ -27,17 +27,12 @@ sequelize
console.error("Unable to connect to the database:", err); console.error("Unable to connect to the database:", err);
}); });
app.get("/", (req, res) => {
res.send("OK");
});
// Add APIs // Add APIs
app.use("/api", BaseRouter); app.use("/api", BaseRouter);
// Print API errors
// eslint-disable-next-line @typescript-eslint/no-unused-vars
app.use((err: Error, req: Request, res: Response) => {
console.error(err, true);
return res.status(500).json({
error: err.message,
});
});
// Export express instance // Export express instance
export default app; export default app;

View file

@ -37,9 +37,9 @@ export const TodoItem = sequelize.define<TodoItemInstance>(
); );
// (re-)creates table (NOT database) // (re-)creates table (NOT database)
if (process.env.DATABASE_INIT === "true") { // if (process.env.DATABASE_INIT === "true") {
TodoItem.sync({ force: true }); TodoItem.sync({ force: true });
} // }
export async function createTodoItem(todoItem: TodoItemCreationAttributes) { export async function createTodoItem(todoItem: TodoItemCreationAttributes) {
return TodoItem.create(todoItem).then((item) => item.get()); return TodoItem.create(todoItem).then((item) => item.get());

View file

@ -1,6 +1,6 @@
dependencies: dependencies:
- name: mariadb - name: mariadb
repository: https://charts.bitnami.com/bitnami repository: https://charts.bitnami.com/bitnami
version: 9.3.14 version: 9.3.11
digest: sha256:d02eb6a8c2a59ec8b2ef307c9d9b8b2154425d50f061d6ce64e891207a25a445 digest: sha256:6817cd0c1ea845bfd715d8d1be6d57c4b1422bcc243783955136e61fc4380c8c
generated: "2021-06-08T16:17:55.86153-04:00" generated: "2021-06-10T14:22:33.263679-04:00"

View file

@ -25,5 +25,5 @@ appVersion: "1.16.0"
dependencies: dependencies:
- name: mariadb - name: mariadb
version: 9.3.14 version: 9.3.11
repository: https://charts.bitnami.com/bitnami repository: https://charts.bitnami.com/bitnami

View file

@ -40,7 +40,7 @@ spec:
{{- end }} {{- end }}
ports: ports:
- name: http - name: http
containerPort: 80 containerPort: 3000
protocol: TCP protocol: TCP
livenessProbe: livenessProbe:
httpGet: httpGet:

View file

@ -5,10 +5,11 @@
replicaCount: 1 replicaCount: 1
image: image:
repository: nginx repository: quay.io/gbianco/todo-backend
pullPolicy: IfNotPresent # pullPolicy: IfNotPresent
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion. # Overrides the image tag whose default is the chart appVersion.
tag: "" tag: latest
imagePullSecrets: [] imagePullSecrets: []
nameOverride: "" nameOverride: ""
@ -38,7 +39,7 @@ securityContext: {}
service: service:
type: ClusterIP type: ClusterIP
port: 80 port: 3000
ingress: ingress:
enabled: false enabled: false
@ -83,9 +84,9 @@ affinity: {}
mariadb: mariadb:
auth: auth:
username: quotes username: todo
password: quotespwd password: todopwd
database: quotesdb database: tododb
primary: primary:
podSecurityContext: podSecurityContext:
enabled: false enabled: false
@ -93,11 +94,13 @@ mariadb:
enabled: false enabled: false
env: env:
- name: "QUOTES_HOSTNAME" - name: DATABASE_NAME
value: "famousapp-mariadb" value: tododb
- name: "QUOTES_DATABASE" - name: DATABASE_USER
value: "quotesdb" value: todo
- name: "QUOTES_USER" - name: DATABASE_PASSWORD
value: "quotes" value: todopwd
- name: "QUOTES_PASSWORD" - name: DATABASE_SVC
value: "quotespwd" value: todo-list-mariadb
- name: DATABASE_INIT
value: "\"true\""