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

View file

@ -1,5 +1,5 @@
import cookieParser from "cookie-parser";
import express, { Request, Response } from "express";
import express from "express";
import "express-async-errors";
import cors from "cors";
import { Sequelize } from "sequelize";
@ -27,17 +27,12 @@ sequelize
console.error("Unable to connect to the database:", err);
});
app.get("/", (req, res) => {
res.send("OK");
});
// Add APIs
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 default app;

View file

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

View file

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

View file

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

View file

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

View file

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