1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-07-31 11:51:59 +00:00

feature: Implement new Server infrastructure with GraphQL. (#132)

* Added new compiler to db

Signed-off-by: Avior <florian.bouillon@delta-wings.net>

* Add compiled DB to artifacts

Signed-off-by: Avior <florian.bouillon@delta-wings.net>

* Fixed space error

Signed-off-by: Avior <florian.bouillon@delta-wings.net>

* Fixed?

Signed-off-by: Avior <florian.bouillon@delta-wings.net>

* Update node.js.yml

* Update node.js.yml

* Made change so the db is no longer dependent on the SDK

Signed-off-by: Avior <florian.bouillon@delta-wings.net>

* f

Signed-off-by: Avior <florian.bouillon@delta-wings.net>

* Fixed artifact

Signed-off-by: Avior <florian.bouillon@delta-wings.net>

* U

Signed-off-by: Avior <florian.bouillon@delta-wings.net>

* \Changed folder

Signed-off-by: Avior <florian.bouillon@delta-wings.net>

* Fixede?

Signed-off-by: Avior <florian.bouillon@delta-wings.net>

* Try with everything

* saved the file ;)

* ignore compiler

* Fixed prebuild being run again

* Fixed public folder

Signed-off-by: Avior <github@avior.me>

* fixed graphql file

Signed-off-by: Avior <github@avior.me>

* fixed?

Signed-off-by: Avior <github@avior.me>

* Check tree because life is potato

Signed-off-by: Avior <github@avior.me>

* this is harder

Signed-off-by: Avior <github@avior.me>

* f

Signed-off-by: Avior <github@avior.me>

* Fixed?

Signed-off-by: Avior <github@avior.me>

* r

Signed-off-by: Avior <github@avior.me>

* fd

Signed-off-by: Avior <github@avior.me>

* added back context

Signed-off-by: Avior <github@avior.me>

* ah

Signed-off-by: Avior <github@avior.me>

* AAH

Signed-off-by: Avior <github@avior.me>

* AAAH

Signed-off-by: Avior <github@avior.me>

* ffffffffffffffffff

Signed-off-by: Avior <github@avior.me>

* fix: Changed the default builder

Signed-off-by: Avior <github@avior.me>

* Removed useless tree function

Signed-off-by: Avior <github@avior.me>
This commit is contained in:
2021-11-04 10:02:26 +01:00
committed by GitHub
parent c991193f4b
commit c4b4449fd4
37 changed files with 5038 additions and 70 deletions

35
server/src/index.ts Normal file
View File

@@ -0,0 +1,35 @@
import express from 'express'
import graphql from './V2/graphql'
import jsonEndpoints from './V2/endpoints/jsonEndpoints'
// Current API version
const VERSION = 2
// Init Express server
const server = express()
// Set global headers
server.use((_, res, next) => {
res
.setHeader('Access-Control-Allow-Origin', '*')
.setHeader('Access-Control-Allow-Methods', 'GET,POST,OPTIONS')
.setHeader('Access-Control-Allow-Headers', 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range')
.setHeader('Access-Control-Expose-Headers', 'Content-Length,Content-Range')
next()
})
server.get('/', (_, res) => {
res.redirect('https://www.tcgdex.net/docs?ref=api.tcgdex.net')
})
server.use(express.static('./public'))
// Setup GraphQL
server.use(`/v${VERSION}/graphql`, graphql)
// Setup JSON endpoints
server.use(`/v${VERSION}`, jsonEndpoints)
// Start server
server.listen(3000)
console.log(`🚀 Server ready at localhost:3000`);