Skip to content

Commit c66cd60

Browse files
committed
server setup for prod hosting
1 parent 5d0857f commit c66cd60

File tree

5 files changed

+3376
-296
lines changed

5 files changed

+3376
-296
lines changed

api/routes/photoRoutes.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = (app) => {
2+
app.get('/api/photos', (req, res) => {
3+
const photos = [
4+
'https://images.unsplash.com/photo-1597065886004-bfb7811d73bd?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=701&q=80',
5+
'https://images.unsplash.com/photo-1597450122094-c9ed4649c16c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=701&q=80',
6+
'https://images.unsplash.com/photo-1597421568577-483a951b99e2?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=704&q=80',
7+
'https://images.unsplash.com/photo-1595459802544-d6cad89f7ae8?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80',
8+
'https://images.unsplash.com/photo-1584143943712-3079939a511f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=609&q=80'
9+
]
10+
11+
res.send({
12+
photos
13+
})
14+
})
15+
}

build-utils/webpack.dev.js

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ const DotenvWebpackPlugin = require("dotenv-webpack");
55
module.exports = {
66
mode: 'development',
77
devtool: 'eval-source-map',
8+
devServer: {
9+
proxy:{
10+
'/api/*' : {
11+
target: 'http://localhost:8080/',
12+
changeOrigin: true,
13+
}
14+
}
15+
},
816
plugins: [
917
new DotenvWebpackPlugin({
1018
path: './.env.development'

0 commit comments

Comments
 (0)