Skip to content

kirankumargonti/MERN-stack-login-authentication

Repository files navigation

Simple User Registration and Login functionality with MongoDB, ExpressJs, React and NodeJs [MERN]

Final App Full-stack MERN app with authentication using passport and JWTs.

This project uses the following technologies:

Configuration

Make sure to add your own mangoURI from your MangoDB database and put in config/default.json.

{
    "mongoURI": "YOUR_MONGO_URI_HERE",
    "secretOrKey": "secret"
}

Quick Start

// Install dependencies for server & client
npm install && npm run client-install

// Run client & server with concurrently
npm run dev

// Server runs on http://localhost:5000 and client on http://localhost:3000

For deploying to Heroku, put this code in server.js or app.js

//Serve static assets if in production
if (process.env.NODE_ENV = "production") {
    app.use(express.static('client/build'));

    app.get('*', (req, res) => {
        res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html'));
    });
}

Make sure to put the script in server package.json file

"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"

for more in deploying to Heroku, please refer to this helpful video by TraversyMedia.

About

Simple User Registration and Login functionality with MongoDB, ExpressJs, React and NodeJs [MERN] Final App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published