mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Implement public folder
This commit is contained in:
parent
c0dc7e3e5d
commit
e46c8d18e5
@ -7,7 +7,7 @@ const legacyUrls = [
|
||||
|
||||
export const fixUrl = (url) => {
|
||||
legacyUrls.forEach((legacyUrl) => {
|
||||
url = url.replace(legacyUrl, '')
|
||||
url = url.replace(legacyUrl, '/api')
|
||||
})
|
||||
return url
|
||||
}
|
||||
|
||||
@ -4,14 +4,14 @@ describe('fixImageURLs', () => {
|
||||
describe('image url of legacy alpha', () => {
|
||||
it('removes domain', () => {
|
||||
const url = 'https://api-alpha.human-connection.org/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png'
|
||||
expect(fixImageURLs(url)).toEqual('/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png')
|
||||
expect(fixImageURLs(url)).toEqual('/api/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png')
|
||||
})
|
||||
})
|
||||
|
||||
describe('image url of legacy staging', () => {
|
||||
it('removes domain', () => {
|
||||
const url = 'https://staging-api.human-connection.org/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg'
|
||||
expect(fixImageURLs(url)).toEqual('/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg')
|
||||
expect(fixImageURLs(url)).toEqual('/api/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import { GraphQLServer } from 'graphql-yoga'
|
||||
import { makeExecutableSchema } from 'apollo-server'
|
||||
import { augmentSchema } from 'neo4j-graphql-js'
|
||||
import { typeDefs, resolvers } from './graphql-schema'
|
||||
import express from 'express'
|
||||
import dotenv from 'dotenv'
|
||||
import mocks from './mocks'
|
||||
import middleware from './middleware'
|
||||
@ -68,6 +69,7 @@ const createServer = (options) => {
|
||||
|
||||
passport.use('jwt', jwtStrategy(driver))
|
||||
server.express.use(passport.initialize())
|
||||
server.express.use(express.static('public'))
|
||||
|
||||
server.express.post('/graphql', passport.authenticate(['jwt'], { session: false }))
|
||||
return server
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user