rachaelcodes / fac-7-nation-army Goto Github PK
View Code? Open in Web Editor NEWFAC Bloopers!
License: GNU General Public License v3.0
FAC Bloopers!
License: GNU General Public License v3.0
create html with sections to manipulate later
Soz it took me a while to build a .env etc.
The app crashes when I try to input data without logging in.
/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)
Managed to log in as undefined?
Can't make a post, goes to a 404
Write your README comments here
When you click anywhere on the screen or type in the boxes remove the warning messages
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);
}
}
https://github.com/rachaelcodes/fac-7-nation-army/blob/master/src/backendHtml.js#L17-L46
I'd strongly recommend replacing all those +=
s with multi-line template literals:
`<button>
<span>
<img src="${e.avatar}" alt="User Avatar" />
<p>${e.faccer}</p>
<article>${e.post}</article>
<p>${e.date}</p>
</span>
</button>
`
etc.
validate JWT
call createPost()
using fs module, as suggested by Finn
Testing helps sooo much with stability and error handling. A little work at the start goes a long way.
in handlers
https://github.com/rachaelcodes/fac-7-nation-army/blob/master/src/backendHtml.js#L75-L96
A waterfall ๐ฆ could work really well here to add clarity to the code.
Comments + error handling too.
In the index.html
checks validity
Someone working remotely should be able to understand your code easily. Lend a brother a hand here!
PSQL INSERT function
dbBuild.sql and .js plus dbConnect.js
make sure router is calling relevant handle functions
see issue #11 first
for handling people's entries
calls checkAuthorisation()
returns payload of isValue message, username, avatar
sends JWT cookie
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
for some reasons, tests work in the terminal, but not in travis
add validation of entries
make sure POST request is sent (new xhr request instead of 'method' in front end)
The app crashes because userDetails
is undefined on line 48
I think you forgot to include const userDetails = process.env.USERDETAILS;
Handle home will check if the user has a cookie and change the login button on the html via the fs module and replace
can it support markdown?
At the moment the I FAC'd up box stays even when not logged in. I'm guessing you only want validated users to be able to post.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.