This repository has been archived by the owner on Apr 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
560c727
commit 15b8e32
Showing
3 changed files
with
32 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import CristataServer from './Cristata'; | ||
|
||
const server = new CristataServer(); | ||
server.start(); | ||
|
||
// log the stack of warnings so we can figure out from where the warning is coming | ||
process.on('warning', (error) => { | ||
console.warn(error); | ||
console.warn(error.stack); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
import CristataServer from './Cristata'; | ||
|
||
const server = new CristataServer(); | ||
server.start(); | ||
|
||
// log the stack of warnings so we can figure out from where the warning is coming | ||
process.on('warning', (error) => { | ||
console.warn(error); | ||
console.warn(error.stack); | ||
}); | ||
import cors from 'cors'; | ||
import express from 'express'; | ||
|
||
if (!process.env.PORT) throw new Error('PORT not defined in env'); | ||
|
||
// create express app | ||
const app = express(); | ||
|
||
// enable CORS for the app | ||
app.use(cors({ origin: true })); | ||
|
||
// always redirect troop-370 file urls since they no longer use Cristata | ||
// but they want the old filestore urls to still work | ||
app.get('/filestore/troop-370/:_id', (req, res) => { | ||
res.redirect(301, `https://troop370atlanta.org/cristata-filestore/${req.params._id}`); | ||
}); | ||
|
||
app.listen(process.env.PORT, () => { | ||
console.log(`Cristata server stub listening on port ${process.env.PORT}!`); | ||
}); |