Compare commits

..

4 commits

Author SHA1 Message Date
Kyle Belanger
c286a2f9c2 add server.js 2025-02-28 11:15:06 -05:00
Kyle Belanger
8a01b0ff35 add app.js 2025-02-28 11:15:00 -05:00
Kyle Belanger
78c052bac9 npm init for server 2025-02-28 11:14:55 -05:00
Kyle Belanger
7338c13b2f add main package.json 2025-02-28 10:55:30 -05:00
5 changed files with 1120 additions and 0 deletions

12
package.json Normal file
View 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
View 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

File diff suppressed because it is too large Load diff

20
server/package.json Normal file
View 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
View 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}`);
});