Compare commits
4 commits
500f22aad4
...
c286a2f9c2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c286a2f9c2 | ||
![]() |
8a01b0ff35 | ||
![]() |
78c052bac9 | ||
![]() |
7338c13b2f |
5 changed files with 1120 additions and 0 deletions
12
package.json
Normal file
12
package.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"name": "react-personal-website",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
27
server/app.js
Normal file
27
server/app.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
const express = require('express');
|
||||||
|
const cors = require('cors');
|
||||||
|
const path = require('path');
|
||||||
|
// const postsRoutes = require('./routes/posts'); //TODO uncomment as this is built
|
||||||
|
// const projectsRoutes = require('./routes/projects'); //TODO uncomment as this is built
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
// Middleware
|
||||||
|
|
||||||
|
app.use(cors());
|
||||||
|
app.use(express.json());
|
||||||
|
|
||||||
|
// API Routes
|
||||||
|
// app.use('/api/posts', postsRoutes); //TODO uncomment as this is built
|
||||||
|
// app.use('/api/projects', projectsRoutes); //TODO uncomment as this is built
|
||||||
|
|
||||||
|
// Serve Static files in production
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
app.use(express.static(path.join(__dirname, '../client/dist')));
|
||||||
|
|
||||||
|
app.get('*', (req, res) => {
|
||||||
|
res.sendFile(path.resolve(__dirname, '../client', 'dist', 'index.html'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = app;
|
1055
server/package-lock.json
generated
Normal file
1055
server/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
20
server/package.json
Normal file
20
server/package.json
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "server",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"description": "",
|
||||||
|
"dependencies": {
|
||||||
|
"cors": "^2.8.5",
|
||||||
|
"express": "^4.21.2",
|
||||||
|
"fs-extra": "^11.3.0",
|
||||||
|
"gray-matter": "^4.0.3",
|
||||||
|
"marked": "^15.0.7",
|
||||||
|
"path": "^0.12.7"
|
||||||
|
}
|
||||||
|
}
|
6
server/server.js
Normal file
6
server/server.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
const app = require('./app');
|
||||||
|
const PORT = process.env.PORT || 5000;
|
||||||
|
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`Server running on port ${PORT}`);
|
||||||
|
});
|
Loading…
Reference in a new issue