diff --git a/client/src/App.css b/client/src/App.css
deleted file mode 100644
index 74b5e05..0000000
--- a/client/src/App.css
+++ /dev/null
@@ -1,38 +0,0 @@
-.App {
- text-align: center;
-}
-
-.App-logo {
- height: 40vmin;
- pointer-events: none;
-}
-
-@media (prefers-reduced-motion: no-preference) {
- .App-logo {
- animation: App-logo-spin infinite 20s linear;
- }
-}
-
-.App-header {
- background-color: #282c34;
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- font-size: calc(10px + 2vmin);
- color: white;
-}
-
-.App-link {
- color: #61dafb;
-}
-
-@keyframes App-logo-spin {
- from {
- transform: rotate(0deg);
- }
- to {
- transform: rotate(360deg);
- }
-}
diff --git a/client/src/App.tsx b/client/src/App.tsx
index a53698a..1b8737b 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -1,24 +1,9 @@
import React from 'react';
-import logo from './logo.svg';
-import './App.css';
function App() {
return (
);
}
diff --git a/client/src/index.css b/client/src/index.css
deleted file mode 100644
index ec2585e..0000000
--- a/client/src/index.css
+++ /dev/null
@@ -1,13 +0,0 @@
-body {
- margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
- sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-
-code {
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
- monospace;
-}
diff --git a/client/src/index.tsx b/client/src/index.tsx
index f5185c1..4146d1d 100644
--- a/client/src/index.tsx
+++ b/client/src/index.tsx
@@ -1,6 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
-import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
diff --git a/client/src/logo.svg b/client/src/logo.svg
deleted file mode 100644
index 6b60c10..0000000
--- a/client/src/logo.svg
+++ /dev/null
@@ -1,7 +0,0 @@
-
diff --git a/server/package.json b/server/package.json
index 52dfd2d..bbc1d63 100644
--- a/server/package.json
+++ b/server/package.json
@@ -2,13 +2,17 @@
"name": "mudbase",
"version": "1.0.0",
"scripts": {
- "start": "nodemon server.js"
+ "start": "node --inspect=5858 -r ts-node/register server.ts",
+ "start:watch": "nodemon",
+ "build": "tsc"
},
"dependencies": {
"body-parser": "^1.18.3",
"express": "^4.16.4",
"sequelize": "^6.3.0",
"sequelize-cli": "^6.2.0",
- "sqlite3": "^5.0.0"
+ "sqlite3": "^5.0.0",
+ "ts-node": "^8.10.2",
+ "typescript": "~3.7.2"
}
}
diff --git a/server/server.js b/server/server.ts
similarity index 75%
rename from server/server.js
rename to server/server.ts
index 0c47096..d128ade 100644
--- a/server/server.js
+++ b/server/server.ts
@@ -10,20 +10,20 @@ const port = process.env.PORT || 5000;
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
-app.get('/api/hello', (req, res) => {
+app.get('/api/hello', (req:any, res:any) => {
res.send({ express: 'Hello From Express' });
});
-app.post('/api/world', (req, res) => {
+app.post('/api/world', (req:any, res:any) => {
console.log(req.body);
res.send(
`I received your POST request. This is what you sent me: ${req.body.post}`,
);
});
-app.post('/song/create', (req, res) => {
+app.post('/song/create', (req:any, res:any) => {
console.log('Create song: ' + JSON.stringify(req.body))
- include = [];
+ let include:any[] = [];
if ("Artist" in req.body) {
include.push(models.Artist);
}
@@ -32,31 +32,33 @@ app.post('/song/create', (req, res) => {
res.sendStatus(200);
});
-app.get('/song/list', (req, res) => {
+app.get('/song/list', (req:any, res:any) => {
console.log("List songs");
models.Song.findAll({
include: [models.Artist]
})
- .then(songs => {
+ .then((songs:any[]) => {
res.send(songs);
});
});
-app.post('/artist/create', (req, res) => {
+app.post('/artist/create', (req:any, res:any) => {
console.log('Create artist: ' + req.body.name)
const artist = models.Artist.build(req.body);
artist.save();
res.sendStatus(200);
});
-app.get('/artist/list', (req, res) => {
+app.get('/artist/list', (req:any, res:any) => {
console.log("List artists");
models.Artist.findAll()
- .then(artists => {
+ .then((artists:any[]) => {
res.send(artists);
});
});
models.sequelize.sync().then(() => {
app.listen(port, () => console.log(`Listening on port ${port}`));
-})
\ No newline at end of file
+})
+
+export {}
\ No newline at end of file
diff --git a/server/tsconfig.json b/server/tsconfig.json
new file mode 100644
index 0000000..f2850b7
--- /dev/null
+++ b/server/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "compilerOptions": {
+ "target": "es5",
+ "lib": [
+ "dom",
+ "dom.iterable",
+ "esnext"
+ ],
+ "allowJs": true,
+ "skipLibCheck": true,
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "strict": true,
+ "forceConsistentCasingInFileNames": true,
+ "module": "esnext",
+ "moduleResolution": "node",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "jsx": "react"
+ },
+ "include": [
+ "src"
+ ]
+}
diff --git a/server/yarn.lock b/server/yarn.lock
index 21c0a35..237791f 100644
--- a/server/yarn.lock
+++ b/server/yarn.lock
@@ -70,6 +70,11 @@ are-we-there-yet@~1.1.2:
delegates "^1.0.0"
readable-stream "^2.0.6"
+arg@^4.1.0:
+ version "4.1.3"
+ resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
+ integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==
+
array-flatten@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
@@ -150,6 +155,11 @@ brace-expansion@^1.1.7:
balanced-match "^1.0.0"
concat-map "0.0.1"
+buffer-from@^1.0.0:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
+ integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
+
bytes@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
@@ -336,6 +346,11 @@ detect-libc@^1.0.2:
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"
integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=
+diff@^4.0.1:
+ version "4.0.2"
+ resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
+ integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
+
dottie@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/dottie/-/dottie-2.0.2.tgz#cc91c0726ce3a054ebf11c55fbc92a7f266dd154"
@@ -823,6 +838,11 @@ lru-queue@0.1:
dependencies:
es5-ext "~0.10.2"
+make-error@^1.1.1:
+ version "1.3.6"
+ resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
+ integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
+
media-typer@0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
@@ -1399,6 +1419,19 @@ signal-exit@^3.0.0:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
+source-map-support@^0.5.17:
+ version "0.5.19"
+ resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
+ integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==
+ dependencies:
+ buffer-from "^1.0.0"
+ source-map "^0.6.0"
+
+source-map@^0.6.0:
+ version "0.6.1"
+ resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
+ integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
+
sqlite3@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/sqlite3/-/sqlite3-5.0.0.tgz#1bfef2151c6bc48a3ab1a6c126088bb8dd233566"
@@ -1536,6 +1569,17 @@ tough-cookie@~2.5.0:
psl "^1.1.28"
punycode "^2.1.1"
+ts-node@^8.10.2:
+ version "8.10.2"
+ resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.10.2.tgz#eee03764633b1234ddd37f8db9ec10b75ec7fb8d"
+ integrity sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==
+ dependencies:
+ arg "^4.1.0"
+ diff "^4.0.1"
+ make-error "^1.1.1"
+ source-map-support "^0.5.17"
+ yn "3.1.1"
+
tunnel-agent@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"
@@ -1566,6 +1610,11 @@ type@^2.0.0:
resolved "https://registry.yarnpkg.com/type/-/type-2.0.0.tgz#5f16ff6ef2eb44f260494dae271033b29c09a9c3"
integrity sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow==
+typescript@~3.7.2:
+ version "3.7.5"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae"
+ integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==
+
umzug@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/umzug/-/umzug-2.3.0.tgz#0ef42b62df54e216b05dcaf627830a6a8b84a184"
@@ -1707,3 +1756,8 @@ yargs@^13.1.0:
which-module "^2.0.0"
y18n "^4.0.0"
yargs-parser "^13.1.2"
+
+yn@3.1.1:
+ version "3.1.1"
+ resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
+ integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==