Skip to content

Commit

Permalink
Fix warnings from cra, add dotenv, use mlab
Browse files Browse the repository at this point in the history
  • Loading branch information
elevenpassin committed Jan 8, 2018
1 parent 40a657d commit 80fd0a9
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ yarn.lock

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
Expand Down
13 changes: 8 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('dotenv').config();
const { find, filter, truncate } = require('lodash');
const express = require('express');
const mongoose = require('mongoose');
Expand All @@ -9,7 +10,7 @@ const { makeExecutableSchema } = require('graphql-tools');

const typeDefs = require('./typeDefs.gql');

const CONNECTION_URL = 'mongodb://localhost:27017/blog';
const CONNECTION_URL = `mongodb://${process.env.dbuser}:${process.env.dbpassword}@${process.env.dbhost}:46377/graphblog`;

mongoose.connect(CONNECTION_URL, {
useMongoClient: true
Expand Down Expand Up @@ -46,7 +47,9 @@ const resolvers = {
addPost: async (_, { title, userid, content }) => {
const newPost = new Post({ title, userid, content })
return newPost.save((err, post) => {
if (err) return console.error(err);
if (err) {
console.error(err);
}
return post;
})
},
Expand Down Expand Up @@ -91,11 +94,11 @@ app.use('/graphql', bodyParser.json(), graphqlExpress({ schema }));

app.use('/graphiql', graphiqlExpress({ endpointURL: '/graphql' }));

app.listen(3001, () => {
app.listen(3003, () => {
console.log(`
=====
Server running at http://localhost:3001/
GraphiQL running at http://localhost:3001/graphiql/
Server running at http://localhost:3003/
GraphiQL running at http://localhost:3003/graphiql/
=====
`)
});
Expand Down
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"react-scripts": "1.0.17"
},
"scripts": {
"start": "react-scripts start",
"start": "set PORT=3002 && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:3001/"
"proxy": "http://localhost:3003/"
}
2 changes: 1 addition & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component, Fragment } from 'react';
import React, { Component } from 'react';
import 'antd/dist/antd.css';
import logo from './logo.svg';
import './App.css';
Expand Down
1 change: 0 additions & 1 deletion client/src/components/BlogpostContainer.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { Component } from 'react';
import { graphql } from 'react-apollo';
import gql from 'graphql-tag';
import { Alert, Card } from 'antd';

import Blogpost from './Blogpost.jsx';

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from 'react-router-dom';

const SubMenu = Menu.SubMenu;
const MenuItemGroup = Menu.ItemGroup;


export default class Navbar extends Component {

Expand Down
4 changes: 2 additions & 2 deletions client/src/components/ShortBlogpost.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react';
import React from 'react';
import { List, Row, Button, Icon, Col } from 'antd';
const Item = List.Item;

Expand All @@ -19,7 +19,7 @@ export default ({ item }) => (
</Col>)]}>
<Row>
<Item.Meta
title={<a href="#">{item.title}</a>}
title={<a href="/">{item.title}</a>}
description={item.truncatedcontent}
/>
</Row>
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/Dashboard.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { Card, Icon, Button, Col, Row, List } from 'antd';
import { Col, Row } from 'antd';

import ShortBlogpostContainer from '../components/ShortBlogpostContainer.jsx';

Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/Signin.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Form, Icon, Input, Button, Checkbox, Row, Col } from 'antd';
import { Form, Icon, Input, Button } from 'antd';
const FormItem = Form.Item;

class NormalLoginForm extends React.Component {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dependencies": {
"apollo-server-express": "^1.3.2",
"body-parser": "^1.18.2",
"dotenv": "^4.0.0",
"express": "^4.16.2",
"graphql": "^0.12.3",
"graphql-tools": "^2.14.1",
Expand Down

0 comments on commit 80fd0a9

Please sign in to comment.