Code Monkey home page Code Monkey logo

fac-7-nation-army's People

Contributors

astroash avatar mineshmshah avatar rachaelcodes avatar y-zaky avatar

Watchers

 avatar

Forkers

astroash

fac-7-nation-army's Issues

create html

create html with sections to manipulate later

Crash on input from non-logged in user

Soz it took me a while to build a .env etc.

The app crashes when I try to input data without logging in.

hmm

/home/finn/fac/teaching-week2/fac-7-nation-army/src/handlers.js:54
  const cookie = sign(userDetails, SECRET);
                      ^

ReferenceError: userDetails is not defined
    at Object.handleLogin (/home/finn/fac/teaching-week2/fac-7-nation-army/src/handlers.js:54:23)
    at Server.router (/home/finn/fac/teaching-week2/fac-7-nation-army/src/router.js:12:25)
    at emitTwo (events.js:125:13)
    at Server.emit (events.js:213:7)
    at parserOnIncoming (_http_server.js:602:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)

remove DOM validation

When you click anywhere on the screen or type in the boxes remove the warning messages

Router cleanup

https://github.com/rachaelcodes/fac-7-nation-army/blob/master/src/router.js#L2

I like to destructure imports that have a bunch of functions.

const { handleHome, handleLogin, handleLogout, handlePublic, handleError } = require('./handlers);

Also I'd probably swap the switch for an object. Something like:

const route = {
    'GET /': handleHome,
    'POST /login': handleLogin,
    'POST /logout': handleLogout,
  }[`${request.method} ${request.url}`];

  if (route) {
    route(request, response);
  } else {
    if (fileList.includes(request.url)) {
      handlePublic(request, response);
    } else {
      console.log(request.url);
      handleError(request, response);
    }
  }

Write some tests

Testing helps sooo much with stability and error handling. A little work at the start goes a long way.

create handleLogin

for handling people's entries
calls checkAuthorisation()
returns payload of isValue message, username, avatar
sends JWT cookie

.env issue

I think line 3 in db_connection.js should read
require('env2')('./config.env');
instead of...
require('env2')('./.env');

We were having troubles logging in with it

Undefined variable in handlers.js

The app crashes because userDetails is undefined on line 48

I think you forgot to include const userDetails = process.env.USERDETAILS;

Handlehome login magic

Handle home will check if the user has a cookie and change the login button on the html via the fs module and replace

Always reference issues!

There are still a bunch of commits without issue references.

commitsissues

Really try to get into the habit of always committing to an issue. I don't think I've reviewed a project in any campus and not raised this issue, but still worth saying ๐Ÿ˜„ It's super important.

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.