Giter Site home page Giter Site logo

express-escape's Introduction

Welcome to Express Escapes - the mistery app ๐Ÿช„

Uuuuuh welcome welcome welcome, I see you passed the first test... not too bad ๐Ÿ˜

Okay so: this repo is the base for your mistery app. ONE member of the team should fork and clone it, and then, start working.

You will be doing pair programming: but that DOESN'T MEAN that only one of you has to do the all the work. All group members will be asked questions about the code, so you all better understand what's going on in the code presented.

โณ Hurry up, you don't have much time!

This boilerplate already has every npm package you need installed, you just need to run:

npm install

Once it's finished, to make sure everything is okay, run:

npm run dev

If it is... the challenge begins.


Challenge 1 ๐Ÿ‘ฃ: users, users, users...

Part 1

  • Create a model for User. Users should have the following fields: name (string), age (number), email (string), hashedPassword (string).
  • Users should be able to signup, login & logout, so you will have to create the routes and views that are necessary for it. When you create the file routes/auth.js, remember to import it on the the app.js file for it to work.
  • Remember to add links in the navbar of the app to these routes to access them easily.

You already have the packages installed and everything configured in the app.js, you just need to work on the routes & views part of authentication.

Part 2

  • Create a new routes file called routes/enigma.js. Remember to import it on the the app.js file for it to work. Create a protected route to localhost:3000/enigmas: only logged in users should be able to see this route. If a user tries to access this route without being authenticated, the route should redirect them to the login page.

You already have a middleware for this in the middlewares folder. Make sure that the auth route for the login is correct and is the same in your app. If it isn't, write the right route to the login page:

module.exports = isLoggedIn = (req, res, next) => {
  if (!req.session.currentUser) {
    // Change this line with your login route if it is different
    return res.redirect('/auth/login');
  }
  next();
};

Remember that you can use the middleware this way:

const isLoggedIn = require('../middlewares');

router.get('/enigmas', isLoggedIn, async (req, res, next) => {
  // ...
})

Create a user for each member of your team.

When you are finished, make sure to commit all changes and then come see us for validation and the NEXT CLUE OF THE CHALLENGE.

express-escape's People

Contributors

alebausa avatar

Stargazers

 avatar

Watchers

 avatar

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.