feat: adjust configs for hosting on heroku
This commit is contained in:
parent
da59f31488
commit
eed44aeb31
@ -2,6 +2,7 @@
|
|||||||
"name": "music-resource-pack-creator-client",
|
"name": "music-resource-pack-creator-client",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"proxy": "http://localhost:3001",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.1.1",
|
"@fortawesome/fontawesome-svg-core": "^6.1.1",
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.1.1",
|
"@fortawesome/free-solid-svg-icons": "^6.1.1",
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
|
|
||||||
const URL = "http://localhost:3001"
|
|
||||||
|
|
||||||
export interface Disc {
|
export interface Disc {
|
||||||
title?: string
|
title?: string
|
||||||
description?: string
|
description?: string
|
||||||
@ -13,7 +11,7 @@ export interface CreatePackPayload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getTitle(url: string): Promise<string | undefined> {
|
export async function getTitle(url: string): Promise<string | undefined> {
|
||||||
const res = await fetch(`${URL}/get-title`, {
|
const res = await fetch(`/get-title`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: url,
|
body: url,
|
||||||
})
|
})
|
||||||
@ -25,7 +23,7 @@ export async function getTitle(url: string): Promise<string | undefined> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function createPack(info: CreatePackPayload) {
|
export async function createPack(info: CreatePackPayload) {
|
||||||
const res = await fetch(`${URL}/create`, {
|
const res = await fetch(`/create`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
mode: "cors",
|
mode: "cors",
|
||||||
headers: { "Content-Type" : "application/json" },
|
headers: { "Content-Type" : "application/json" },
|
||||||
@ -35,7 +33,6 @@ export async function createPack(info: CreatePackPayload) {
|
|||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
return await res.blob()
|
return await res.blob()
|
||||||
} else {
|
} else {
|
||||||
console.log(res)
|
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,16 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "NODE_ENV=production node dist/index.js",
|
"start": "NODE_ENV=production ts-node src/index.ts",
|
||||||
"dev": "NODE_ENV=development nodemon src/index.ts",
|
"dev": "NODE_ENV=development nodemon src/index.ts",
|
||||||
"build": "tsc"
|
"build": "cd client && yarn && yarn build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hapi/hapi": "^20.2.1",
|
"@hapi/hapi": "^20.2.1",
|
||||||
|
"@hapi/inert": "^6.0.5",
|
||||||
"@types/fluent-ffmpeg": "^2.1.20",
|
"@types/fluent-ffmpeg": "^2.1.20",
|
||||||
"@types/hapi__hapi": "^20.0.10",
|
"@types/hapi__hapi": "^20.0.10",
|
||||||
|
"@types/hapi__inert": "^5.2.3",
|
||||||
"@types/node": "^17.0.23",
|
"@types/node": "^17.0.23",
|
||||||
"@types/temp": "^0.9.1",
|
"@types/temp": "^0.9.1",
|
||||||
"fluent-ffmpeg": "^2.1.2",
|
"fluent-ffmpeg": "^2.1.2",
|
||||||
|
23
src/index.ts
23
src/index.ts
@ -163,9 +163,16 @@ function addCreateRoute(server: hapi.Server) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
let host = undefined
|
||||||
|
let port = process.env.PORT || 3000
|
||||||
|
if (process.env.NODE_ENV == "development") {
|
||||||
|
host = "localhost"
|
||||||
|
port = 3001
|
||||||
|
}
|
||||||
|
|
||||||
const server = hapi.server({
|
const server = hapi.server({
|
||||||
port: process.env.PORT || 3000,
|
port,
|
||||||
host: 'localhost',
|
host,
|
||||||
routes: {
|
routes: {
|
||||||
cors: true
|
cors: true
|
||||||
}
|
}
|
||||||
@ -174,6 +181,18 @@ async function main() {
|
|||||||
addGetTitleRoute(server)
|
addGetTitleRoute(server)
|
||||||
addCreateRoute(server)
|
addCreateRoute(server)
|
||||||
|
|
||||||
|
await server.register(require('@hapi/inert'))
|
||||||
|
|
||||||
|
server.route({
|
||||||
|
method: "GET",
|
||||||
|
path: "/{param*}",
|
||||||
|
handler: {
|
||||||
|
directory: {
|
||||||
|
path: "client/build"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
await server.start()
|
await server.start()
|
||||||
console.log("Server running on %s", server.info.uri)
|
console.log("Server running on %s", server.info.uri)
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"baseUrl": "src",
|
"baseUrl": "/src",
|
||||||
"outDir": "dist",
|
"outDir": "/dist",
|
||||||
"rootDirs": ["src"],
|
"rootDirs": ["src"],
|
||||||
"paths": {
|
"paths": {
|
||||||
"~/*": ["*"]
|
"~/*": ["*"]
|
||||||
|
35
yarn.lock
35
yarn.lock
@ -22,7 +22,7 @@
|
|||||||
"@hapi/boom" "9.x.x"
|
"@hapi/boom" "9.x.x"
|
||||||
"@hapi/hoek" "9.x.x"
|
"@hapi/hoek" "9.x.x"
|
||||||
|
|
||||||
"@hapi/ammo@^5.0.1":
|
"@hapi/ammo@5.x.x", "@hapi/ammo@^5.0.1":
|
||||||
version "5.0.1"
|
version "5.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/@hapi/ammo/-/ammo-5.0.1.tgz#9d34560f5c214eda563d838c01297387efaab490"
|
resolved "https://registry.yarnpkg.com/@hapi/ammo/-/ammo-5.0.1.tgz#9d34560f5c214eda563d838c01297387efaab490"
|
||||||
integrity sha512-FbCNwcTbnQP4VYYhLNGZmA76xb2aHg9AMPiy18NZyWMG310P5KdFGyA9v2rm5ujrIny77dEEIkMOwl0Xv+fSSA==
|
integrity sha512-FbCNwcTbnQP4VYYhLNGZmA76xb2aHg9AMPiy18NZyWMG310P5KdFGyA9v2rm5ujrIny77dEEIkMOwl0Xv+fSSA==
|
||||||
@ -139,6 +139,18 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.2.1.tgz#9551142a1980503752536b5050fd99f4a7f13b17"
|
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.2.1.tgz#9551142a1980503752536b5050fd99f4a7f13b17"
|
||||||
integrity sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw==
|
integrity sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw==
|
||||||
|
|
||||||
|
"@hapi/inert@^6.0.5":
|
||||||
|
version "6.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/@hapi/inert/-/inert-6.0.5.tgz#0c5a28e9b5a637d3d47419859bb7163d0b194a61"
|
||||||
|
integrity sha512-eVAdUVhJLmmXLM/Zt7u5H5Vzazs9GKe4zfPK2b97ePHEfs3g/AQkxHfYQjJqMy11hvyB7a21Z6rBEA0R//dtXw==
|
||||||
|
dependencies:
|
||||||
|
"@hapi/ammo" "5.x.x"
|
||||||
|
"@hapi/boom" "9.x.x"
|
||||||
|
"@hapi/bounce" "2.x.x"
|
||||||
|
"@hapi/hoek" "9.x.x"
|
||||||
|
"@hapi/validate" "1.x.x"
|
||||||
|
lru-cache "^6.0.0"
|
||||||
|
|
||||||
"@hapi/iron@6.x.x", "@hapi/iron@^6.0.0":
|
"@hapi/iron@6.x.x", "@hapi/iron@^6.0.0":
|
||||||
version "6.0.0"
|
version "6.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/@hapi/iron/-/iron-6.0.0.tgz#ca3f9136cda655bdd6028de0045da0de3d14436f"
|
resolved "https://registry.yarnpkg.com/@hapi/iron/-/iron-6.0.0.tgz#ca3f9136cda655bdd6028de0045da0de3d14436f"
|
||||||
@ -325,7 +337,7 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/hapi__catbox/-/hapi__catbox-10.2.4.tgz#4d0531a6c2d0e45024f724020d536041ef8ffe30"
|
resolved "https://registry.yarnpkg.com/@types/hapi__catbox/-/hapi__catbox-10.2.4.tgz#4d0531a6c2d0e45024f724020d536041ef8ffe30"
|
||||||
integrity sha512-A6ivRrXD5glmnJna1UAGw87QNZRp/vdFO9U4GS+WhOMWzHnw+oTGkMvg0g6y1930CbeheGOCm7A1qHsqH7AXqg==
|
integrity sha512-A6ivRrXD5glmnJna1UAGw87QNZRp/vdFO9U4GS+WhOMWzHnw+oTGkMvg0g6y1930CbeheGOCm7A1qHsqH7AXqg==
|
||||||
|
|
||||||
"@types/hapi__hapi@^20.0.10":
|
"@types/hapi__hapi@*", "@types/hapi__hapi@^20.0.10":
|
||||||
version "20.0.10"
|
version "20.0.10"
|
||||||
resolved "https://registry.yarnpkg.com/@types/hapi__hapi/-/hapi__hapi-20.0.10.tgz#890d8d5c3b12337ba6e4ea9e33d8aec5d62bbc25"
|
resolved "https://registry.yarnpkg.com/@types/hapi__hapi/-/hapi__hapi-20.0.10.tgz#890d8d5c3b12337ba6e4ea9e33d8aec5d62bbc25"
|
||||||
integrity sha512-Nt/SY/20/JAlHhbgH616j0g18vsANR9OWoyMdQcytlW6o7TBN+wRgf0MB8AgzjYpuzQam5oTiqyED9WwHmQKYQ==
|
integrity sha512-Nt/SY/20/JAlHhbgH616j0g18vsANR9OWoyMdQcytlW6o7TBN+wRgf0MB8AgzjYpuzQam5oTiqyED9WwHmQKYQ==
|
||||||
@ -339,6 +351,13 @@
|
|||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
joi "^17.3.0"
|
joi "^17.3.0"
|
||||||
|
|
||||||
|
"@types/hapi__inert@^5.2.3":
|
||||||
|
version "5.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/hapi__inert/-/hapi__inert-5.2.3.tgz#f586eb240d5997c9968d1b4e8b37679517045ca1"
|
||||||
|
integrity sha512-I1mWQrEc7oMqGtofT0rwBgRBCBurz0wNzbq8QZsHWR+aXM0bk1j9GA6zwyGIeO53PNl2C1c2kpXlc084xCV+Tg==
|
||||||
|
dependencies:
|
||||||
|
"@types/hapi__hapi" "*"
|
||||||
|
|
||||||
"@types/hapi__mimos@*":
|
"@types/hapi__mimos@*":
|
||||||
version "4.1.4"
|
version "4.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/@types/hapi__mimos/-/hapi__mimos-4.1.4.tgz#4f8a1c58345fc468553708d3cb508724aa081bd9"
|
resolved "https://registry.yarnpkg.com/@types/hapi__mimos/-/hapi__mimos-4.1.4.tgz#4f8a1c58345fc468553708d3cb508724aa081bd9"
|
||||||
@ -907,6 +926,13 @@ lowercase-keys@^2.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479"
|
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479"
|
||||||
integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==
|
integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==
|
||||||
|
|
||||||
|
lru-cache@^6.0.0:
|
||||||
|
version "6.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
|
||||||
|
integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
|
||||||
|
dependencies:
|
||||||
|
yallist "^4.0.0"
|
||||||
|
|
||||||
lru-cache@^7.4.0:
|
lru-cache@^7.4.0:
|
||||||
version "7.8.0"
|
version "7.8.0"
|
||||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.8.0.tgz#649aaeb294a56297b5cbc5d70f198dcc5ebe5747"
|
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.8.0.tgz#649aaeb294a56297b5cbc5d70f198dcc5ebe5747"
|
||||||
@ -1370,6 +1396,11 @@ xdg-basedir@^4.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-4.0.0.tgz#4bc8d9984403696225ef83a1573cbbcb4e79db13"
|
resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-4.0.0.tgz#4bc8d9984403696225ef83a1573cbbcb4e79db13"
|
||||||
integrity sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==
|
integrity sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==
|
||||||
|
|
||||||
|
yallist@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
|
||||||
|
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
|
||||||
|
|
||||||
yn@3.1.1:
|
yn@3.1.1:
|
||||||
version "3.1.1"
|
version "3.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
|
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
|
||||||
|
Loading…
Reference in New Issue
Block a user