Coder Social home page Coder Social logo

storybooks's Introduction

StoryBooks

Create public and private stories from your life

This app uses Node.js/Express/MongoDB with Google OAuth for authentication

Usage

Add your mongoDB URI and Google OAuth credentials to the config.env file

# Install dependencies
npm install

# Run in development
npm run dev

# Run in production
npm start

storybooks's People

Contributors

adilshaik avatar bradtraversy avatar dependabot[bot] avatar kristinachausheva avatar maxwellmckinnon avatar mellonis avatar nelson-chinedu avatar netmagik avatar olonsdale avatar peterjyc avatar rafasfz avatar saira512dev avatar techlead-21 avatar tpojka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

storybooks's Issues

Logout redirect issue

On auth.js((routes/auth.js) unable to 'Logout'
Error msg :- req#logout requires a callback function

Problem with Logging Out

I noticed that I can log back in to the app right after I logged out. In fact, even if I clear the localhost's cookie or the session table in mongodb, I can still log in without a password right after I logged out.

Does anyone know how to resolve this?

error at npm start

after installing the dependencies and adding mongoDB URI and Google OAuth credentials to the config.env file when we do npm start this happens

npm start
npm WARN lifecycle The node binary used for scripts is C:\Program Files\heroku\client\bin\node.exe but npm is using C:\Program Files\nodejs\node.exe itself. Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with.

[email protected] start C:\Users\Vinay\Downloads\storybooks-master
cross-env NODE_ENV=production node app

events.js:287
throw er; // Unhandled 'error' event
^

Error: listen EACCES: permission denied 3000;
at Server.setupListenHandle [as _listen2] (net.js:1296:21)
at listenInCluster (net.js:1361:12)
at Server.listen (net.js:1460:5)
at Function.listen (C:\Users\Vinay\Downloads\storybooks-master\node_modules\express\lib\application.js:618:24)
at Object. (C:\Users\Vinay\Downloads\storybooks-master\app.js:100:5)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1340:8)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
code: 'EACCES',
errno: 'EACCES',
syscall: 'listen',
address: '3000;',
port: -1
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: cross-env NODE_ENV=production node app
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Vinay\AppData\Roaming\npm-cache_logs\2020-07-22T10_28_18_929Z-debug.log

handlebars isn't working

Hello, I have been trying to get handlebar-express working with this app. I have tried to do it exactly the way brad has it, and I have copied it in from handlebars npm docs.

lastly I copied the code directly in from the github.

const exphbs = require('express-handlebars');

app.engine('.hbs', exphbs())
app.set('view engine', '.hbs')

with this one is is telling me that the app crashed - waiting for file changes before starting. and it is pointing at storybook-project\app.js:35 exphbs( ^
saying TypeError: exphbs is not a function

its kind of working when I use
var hbs = require('hbs')

// app.set('view engine', 'hbs')
// app.set('views', './views')

but when I use this the css styling isn't working. I have googled everything I can think of, but I can't figure this out.

req.logout() Change in new version of passport

The logout route was previously:

router.get('/logout', (req, res, next) => {
req.logout();
res.redirect('/')
})

should be modified to:

router.get('/logout', (req, res, next) => {
req.logout((error)=>{
if (error) {return next(error)}
res.redirect('/')
});
})

Error connecting to MongoDB

When I try to connect to the database (14:00 in Brad's video), after the server is up and running ("Server running in development mode on port 3000") there is a pause and then it times out giving me the following error message:

Error: querySrv ETIMEOUT _mongodb._tcp.cluster0.bnqzq.mongodb.net
at QueryReqWrap.onresolve [as oncomplete] (dns.js:203:19) {
errno: undefined,
code: 'ETIMEOUT',
syscall: 'querySrv',
hostname: '_mongodb._tcp.cluster0.bnqzq.mongodb.net'
}
[nodemon] app crashed - waiting for file changes before starting...

I've made sure that my IP is whitelisted but this has not helped.

Server not reloading on non-js file save

I have my script setup as
"dev": "cross-env NODE_ENV=development nodemon app"

When I save .js files, it works fine, but when I save anything else, it doesn't and I have to restart the server to see the updates.

saving tags inside the database without sanatizing

I noticed you can save tags inside the database without being sanitized into "& l t ;" or sth like that,
that can be used by attackers in production mode, to inject js code written by others, to run on other users machines

can you notify me if I'm wrong and it gets sanitized, and where it gets sanitized?

req.user.firstName is undefined

I am trying to access the req.user.firstName in the index.js file in Routes folder but it does not print the name, instead it shows undefined. Please help me fix this

Oauth error when deploying to heroku

How to reproduce

I'm attempting to deploy this application to heroku. I have successfully deployed the application to heroku and added the redirectURI to my google cloud environment.

My problem

When it comes to logging in through Oauth, I receive the error "Error 400: redirect_uri_mismatch". This is because heroku listens for an HTTP request and not an HTTPS request, and google requires HTTPS when in production.

image

Steps taken so far

I have changed the callbackURI in /config/passport.js to force HTTP when in production, and changed proxy to true:

passport.js

const GoogleStrategy = require("passport-google-oauth20").Strategy
const mongoose = require("mongoose")
const User = require("../models/User")

module.exports = function (passport) {
    if (process.env.NODE_ENV === "development") {
        passport.use(new GoogleStrategy({
            clientID: process.env.GOOGLE_CLIENT_ID,
            clientSecret: process.env.GOOGLE_CLIENT_SECRET,
            callbackURL: "http://localhost:3000/auth/google/callback",
            proxy: true
        },
            // original params
    } else {
        passport.use(new GoogleStrategy({
            clientID: process.env.GOOGLE_CLIENT_ID,
            clientSecret: process.env.GOOGLE_CLIENT_SECRET,
            callbackURL: "http://polar-forest-68113.herokuapp.com/auth/google/callback",
            proxy: true
        },
            // original params
}

Just wondering if anyone could help me with this, cheers ๐Ÿ˜

Need help with express.router not working ??

I'm at the step where you implement the routes using express.router.
If I use "app.get("/"... " in app.js it works fine. But when I try app.use("/", require("./routes/index")) it fails with "GET / 404".
It can't read the route.
Is there is something I'm not doing right?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.