Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Other-instances
A differents web apps for learning purpurose its include MERN stack the most time for full-stack dev.

Hi there, I left some examples when learning web app content ;)
74 changes: 74 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
const path = require('path');
const express = require('express');
const bodyParser = require('body-parser');
const session = require('express-session');
const cors = require('cors');
const errorHandler = require('errorhandler');
const mongoose = require('mongoose');

const app = express();

mongoose.promise = global.Promise;

const isProduction = process.env.NODE_ENV === 'production';

const db = require('./config/keys').mongoURI;

mongoose.connect(db)
.then(() => console.log('Połączony...'))
.catch(err => console.log(err) );

require('./models/Articles.js');
routes = require('./routes/index.js');


app.use(cors());
app.use(require('morgan')('dev'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, 'public')));
app.use(session({ secret: 'MałyBlog', cookie: { maxAge: 60000 }, resave: false, saveUninitialized: false }));

if(!isProduction) {
app.use(errorHandler());
}


mongoose.set('debug', true);


app.use(require('./routes'));


app.use((req, res, next) => {
const err = new Error('Not Found')
err.status = 404
next(err)
});

if (!isProduction) {
app.use((err, req, res) => {
res.status(err.status || 500);

res.json({
errors: {
message: err.message,
error: err,
},
});
});
}

app.use((err, req, res) => {
res.status(err.status || 500);

res.json({
errors: {
message: err.message,
error: {},
},
});
});

const port = process.env.PORT || 8000;
app.listen(port, () => console.log('Server działa na http://localhost:8000'));
1 change: 1 addition & 0 deletions client/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"> <link rel=stylesheet href=https://use.fontawesome.com/releases/v5.0.10/css/all.css integrity=sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg crossorigin=anonymous> <title>MałyBlog</title> <link href="/style.css?174e5ebc64fd475d34c5" rel="stylesheet"></head> <body> <noscript> Gdzie twój Javascript do Apki?!. </noscript> <div id=root></div> <script src=https://code.jquery.com/jquery-3.2.1.slim.min.js integrity=sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN crossorigin=anonymous></script> <script src=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js integrity=sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q crossorigin=anonymous></script> <script src=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js integrity=sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl crossorigin=anonymous></script> <script type="text/javascript" src="/./main.js?174e5ebc64fd475d34c5"></script></body> </html>
29 changes: 29 additions & 0 deletions client/dist/main.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions client/dist/style.css

Large diffs are not rendered by default.

Loading