Skip to content

Commit

Permalink
feat: server
Browse files Browse the repository at this point in the history
  • Loading branch information
Away0x committed Aug 17, 2020
1 parent 4df29f2 commit ccc977d
Show file tree
Hide file tree
Showing 3 changed files with 682 additions and 44 deletions.
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"version": "0.1.0",
"private": true,
"scripts": {
"server:dev": "node server.js",
"server:prod:start": "pm2 start ./server.js --name react-cloud-music",
"server:prod:stop": "pm2 stop react-cloud-music",
"server:prod:restart": "pm2 restart react-cloud-music",
"server:prod:status": "pm2 describe react-cloud-music",
"server:prod:monit": "pm2 monit",
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
Expand All @@ -28,7 +34,10 @@
"aw-easy-storage": "^0.0.1",
"axios": "^0.19.2",
"better-scroll": "^2.0.0-beta.10",
"compression": "^1.7.4",
"express": "^4.17.1",
"mitt": "^2.1.0",
"pm2": "^4.4.0",
"qs": "^6.9.4",
"react": "^16.13.1",
"react-dom": "^16.13.1",
Expand Down
17 changes: 17 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const express = require('express');
const compression = require('compression');

const port = process.env.PORT || 8010;
const app = express();

app.use(compression());
app.use(express.static('./build'));

module.exports = app.listen(port, (err) => {
if (err) {
console.log(err);
return;
}

console.log(`Listening at http://localhost:${port}\n`);
});
Loading

0 comments on commit ccc977d

Please sign in to comment.