Skip to content

Commit 463c37c

Browse files
author
iskanderandrews
committed
Preparing Server for deployment into production
1 parent 9c87322 commit 463c37c

30 files changed

+3910
-3598
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
/node_modules
55
/.pnp
66
.pnp.js
7+
/client
8+
/client-suspende
79

810
# testing
911
/coverage
1012

1113
# production
14+
/build
1215

1316
# misc
1417
.DS_Store

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: node app.js

app.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const fileUploader = require('express-fileupload');
44
const bodyParser = require('body-parser');
55
const mongoose = require('mongoose');
66
const path = require('path');
7+
const compression = require('compression');
8+
const helmet = require('helmet');
79

810
// Constants
911
const app = express();
@@ -12,10 +14,18 @@ const app = express();
1214
const authRoutes = require('./routes/auth');
1315
const accountsRoutes = require('./routes/accounts');
1416
const artistRoutes = require('./routes/artist');
17+
const tokenRouter = require('./routes/tokens');
18+
19+
20+
app.use(helmet());
21+
app.use(compression());
1522

1623
//app.use(bodyParser.urlencoded()); // x-www-form-urlencoded <form>
17-
app.use(bodyParser.json()); // application/json
24+
25+
// application/json
26+
app.use(bodyParser.json());
1827
app.use(fileUploader());
28+
1929
//app.use('/app', express.favicon(__dirname + '/public/favicon.ico'));
2030
//app.use(express.static(path.join(__dirname, 'client-suspended/public')));
2131

@@ -34,6 +44,7 @@ app.use((req, res, next) => {
3444
app.use('/api/accounts',accountsRoutes);
3545
app.use('/api/artist', artistRoutes);
3646
app.use('/api/auth', authRoutes);
47+
app.use('/api/tokens', tokenRouter);
3748

3849
app.use((error, req, res, next) => {
3950
console.log(error);
@@ -46,20 +57,23 @@ app.use((error, req, res, next) => {
4657
.json({ message: message, data: data })
4758
});
4859

60+
// TODO: Adding SSL
61+
4962
//const url = `mongodb://admin:[email protected]:27017,cf-shard-00-01-r3ep6.mongodb.net:27017,cf-shard-00-02-r3ep6.mongodb.net:27017/test?ssl=true&replicaSet=cf-shard-0&authSource=admin&retryWrites=true&w=majority`;
5063

5164
// Connection to db and start server
5265
mongoose
5366
.connect(
54-
`mongodb+srv://admin:P1MHMf6mrnjuA1hr@cf-r3ep6.mongodb.net/test?retryWrites=true&w=majority`
67+
`mongodb+srv://${process.env.MONDO_USER}:${process.env.MONDO_PASSWORD}@cf-r3ep6.mongodb.net/test?retryWrites=true&w=majority`
5568
)
5669
.then(result => {
57-
app.listen(5000);
70+
app.listen(process.env.PORT || 5000);
5871
console.log('##################################');
5972
console.log('MongoDB Connected...');
6073
console.log('Server Connected...');
6174
console.log('##################################');
6275
})
6376
.catch(err =>{
77+
// console.log(`%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%${process.env.production.MONDO_USER}`);
6478
console.log(err)
6579
});

client/.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@ SKIP_PREFLIGHT_CHECK=true
33
REACT_APP_BACKEND_PORT=5000
44
REACT_APP_BACKEND_URL="http://localhost:"
55
REACT_APP_BACKEND_API=${REACT_APP_BACKEND_URL}${REACT_APP_BACKEND_PORT}/api
6+
7+
export INFURA_KEY="90e2c974a2de456bae91fe195e54a609"
8+
export MNEMONIC="dinner trend hybrid hair pet coyote journey renew what forest giraffe culture"
9+
export NETWORK="rinkeby"
10+
11+
export OWNER_ADDRESS="0x34b8D058dF685De17C64B46248d4794Ff87bB458"
12+
export NFT_CONTRACT_ADDRESS="0xdC9Dc258Dd8b7b5874069215aE961e4951791Bac"

0 commit comments

Comments
 (0)