Skip to content

Commit

Permalink
fix: cors for pokeapi proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
scissorsneedfoodtoo committed Nov 16, 2023
1 parent 68fe938 commit 31f8286
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
21 changes: 21 additions & 0 deletions apps/pokeapi-proxy/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/pokeapi-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "MIT",
"dependencies": {
"axios": "1.6.0",
"cors": "2.8.5",
"dotenv": "16.3.1",
"express": "4.18.2",
"node-cache": "5.1.2"
Expand Down
4 changes: 4 additions & 0 deletions apps/pokeapi-proxy/server.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import 'dotenv/config';
import express from 'express';
import cors from 'cors';
import { router as pokemonRouter } from './api/pokemon/pokemon.routes.mjs';
const portNum = process.env.PORT || 3000;
const app = express();

// Serve static content and landing page
app.use(express.static('public'));

// CORS
app.use(cors());

app.get('/', (req, res) => {
res.sendFile(__dirname + '/views/index.html');
});
Expand Down

0 comments on commit 31f8286

Please sign in to comment.