Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Brad
@bradtaniguchi
@ehsansh Your server should be able to serve the folder made with build. So when you go to locahost:8080 or whatever port you run the server on (not your dev server with nodemon, but your "prod" version of express) the stuff from your build folder should appear
Liam Docherty
@liamdocherty
@tiagocorreiaalmeida Thanks for the reply, I found some all good.
CamperBot
@camperbot
liamdocherty sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 514 | @tiagocorreiaalmeida |http://www.freecodecamp.org/tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Ehsan Shadmehri
@ehsansh
@bradtaniguchi Thanks but I am confused. In the article server receives some requests and it sends some data. It does not have any code for rendering the build folder. So should I make server.js file to serve the build older? But how?
CamperBot
@camperbot
ehsansh sends brownie points to @bradtaniguchi :sparkles: :thumbsup: :sparkles:
:cookie: 457 | @bradtaniguchi |http://www.freecodecamp.org/bradtaniguchi
Brad
@bradtaniguchi
@ehsansh I don't use express that much, nor did I look into the article, I would do some googling and I think there would be some documentation on serving a folder by default. (its a very very common use case)
rk
@rajkumart08_twitter

Hi,

  • I am trying to learn angular 2.
  • after including this line in the declaration PlayerContacts, I am getting below error.
  • can you tell me how to fix it.
  • providing my app.module.ts code below.
  • I have included PlayerContacts in app.component.ts, since the code is big I didnt paste that code.

VM39359:34 Unhandled Promise rejection: Failed to load app/component/Player/Player-contacts.html ; Zone: <root> ; Task: Promise.then ; Value: Failed to load app/component/Player/Player-contacts.html

Error: Uncaught (in promise): Failed to load app/component/Player/Player-contacts.html
at resolvePromise (zone.js:418)
at resolvePromise (zone.js:403)
at zone.js:451
at ZoneDelegate.invokeTask (zone.js:225)
at Zone.runTask (zone.js:125)
at drainMicroTaskQueue (zone.js:357)
at XMLHttpRequest.ZoneTask.invoke (zone.js:297)

Uncaught TypeError: Converting circular structure to JSON
at JSON.stringify (<anonymous>)
at console.window.console.error (<anonymous>:36:101)
at consoleError (zone.js:346)
at _loop_1 (zone.js:371)
at drainMicroTaskQueue (zone.js:375)
at XMLHttpRequest.ZoneTask.invoke (zone.js:297)


    import './rxjs-extensions';

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { NgIdleModule } from '@ng-idle/core';
import { AppComponent } from './app.component';
import { ErrorHandler } from '@angular/core';
//import { idleService }         from './app.idleService';

import { Base } from './components/base/base';
import { PlayerUser } from './components/Player/user';
import { Player } from './components/Player/Player';
import { Reports } from './components/reports/reports';
import { PlayerFunctionalRoles } from './components/Player/functional-roles';
import { PlayerDepartmentRoleMapping } from './components/Player/department-role-mapping';
import { PlayerAspects } from './components/Player/aspects';
import { PlayerFunctionalRolesMap } from './components/Player/functional-role-mapping';
import { PlayerTitleOwner } from './components/Player/titleOwner';
import { PlayerDeleteContract } from './components/Player/deleteContract';
import { PlayerDeleteTitle } from './components/Player/deleteTitle';
import { PlayerNonEpisodicShowName } from './components/Player/non-episodic-show-name'
 import { PlayerContacts } from './components/Player/Player-contacts'



import {
    Routes,
    RouterModule,
    Router,
    ActivatedRoute,

    CanActivateChild,
    CanDeactivate,
    ActivatedRouteSnapshot,
    RouterStateSnapshot
} from "@angular/router";

@NgModule({
    imports: [
        BrowserModule,
        FormsModule,
        ReactiveFormsModule,
        HttpModule,
        routing,
        MultiselectDropdownModule,
        AccordionModule,
        NgIdleModule.forRoot()
    ],
    declarations: [
        AppComponent,
        // idleService,
        Base,

        PlayerNonEpisodicShowName,
        PlayerContacts
    ],
    providers: [
        SPORTSService, { provide: ErrorHandler, useClass: ApplicationErrorHandler }],
    bootstrap: [AppComponent]
})
export class AppModule {
}
zootechdrum
@zootechdrum
hey guys what is up
quick question
how can I make sure that random number never lands on the same number twice
here is the specific code
var q1 = ["Crazy' is a term of art; 'Insane' is a term of law. Remember that, and you will save yourself a lot of trouble.","Some may never live, but the crazy never die.","In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity.","I learned a long time ago that reality was much weirder than anyone's imagination."]


$(document).ready(function(){
  $("button").click(function(){
    $("#quote").text(q1[Math.floor(Math.random() * 4)]
   )}
 )}
)
Ehsan Shadmehri
@ehsansh
@bradtaniguchi Thanks. I add these two line of codes to server/src/app.js file and now it servers from the build folder
const path = require('path')    // <-- added
app.use(express.static(path.join(__dirname, '../../client/dist')))
Brad
@bradtaniguchi
nice, just verify you can't access any of the backend folders (like where your server code is) and you should be good
@rajkumart08_twitter You have a stackblitz for this?
@rajkumart08_twitter From what I see what does the class delcaration for player-contacts.component.ts look like? (the component decorator and class name stuff)
cuse it looks like the name of the player-component has a caps, and angular is complaning the .html file isn't found.
Ehsan Shadmehri
@ehsansh
@bradtaniguchi But the only problem I have is that as this project has 4-5 pages. It works great when I click on the links because I have used vue-router but when I want to open the links directly it does not work. for example this link: http://localhost:8081/posts does not open.
I am not sure what I have done is the best practice.
Ken Haduch
@khaduch
@zootechdrum - since a random number is supposed to be "random" it could come to the same number twice, especially if you only have 4 possibilities, it looks like that is what you are limiting it to. But you could do something like keep a variable to "remember" the last number that came up, and make a loop that will keep generating random numbers until it gets something different. That would at least prevent repeated values. And obviously the larger your set of possible numbers, the less of a chance it will hit the same one often, but that's not guaranteed. You could remember a series of the latest numbers and check against them all, and use the same technique, then add additional numbers to your list, and remove the oldest value.
Brad
@bradtaniguchi
@ehsansh This is because when you go to the /post routes your asking express for this, which doesn't exist on express's side. So usually you redirect the user to the index.html, for that route. You might have to lookup how to handle this in vue. (There's also the "hash" routing strategy which is usually an option, but it makes less nice urls, as they start with a hash)
Ehsan Shadmehri
@ehsansh
@bradtaniguchi Yes. I think I have seen a solution in videos of this repo: https://github.com/blogscot/tab-tracker .I should search to find.
What is your idea about this way of coding for vue and express in one project?
Brad
@bradtaniguchi
idk, I don't use express or vue. (I use Angular tho, so its similar in terms of both being a SPA
Ehsan Shadmehri
@ehsansh
@bradtaniguchi thanks
CamperBot
@camperbot
:cookie: 458 | @bradtaniguchi |http://www.freecodecamp.org/bradtaniguchi
ehsansh sends brownie points to @bradtaniguchi :sparkles: :thumbsup: :sparkles:
Brad
@bradtaniguchi
@ehsansh np, this is another common issue so I know the sources are out there. (I don't work on the backend so idk how we solve the same problem your having right now, its some sort of redirect tho)
Alvin
@AlvinW89
Second Attempt On first Project. Any Feedback: https://codepen.io/alvinw89/full/zWQgXm/
Better in desktop view
Devina
@Devina
@zootechdrum, if the random number set is low, one way is to push and keep the random number into an array. Then, when you run a statement for the random number, check if is present in array. If present then redo the random number generation, otherwise keep it and push into array.
include*engine
@newtothat
@AlvinW89 i loved your tribute page
Alvin
@AlvinW89
Thanks @newtothat
CamperBot
@camperbot
alvinw89 sends brownie points to @newtothat :sparkles: :thumbsup: :sparkles:
api offline
include*engine
@newtothat
how long you learning
Alvin
@AlvinW89
About 2-3 years. Mostly free resources I could fine. I been learnign from TeamTreeHosue for the past month
doing there front-end
But it a lot of follow along and FreeCodeCamp lets you think XD
So I am doing both now
include*engine
@newtothat
so whats the difference between two?
Alvin
@AlvinW89
From Youtube videos to jon duckett books
include*engine
@newtothat
books?
Alvin
@AlvinW89
well TeamTreeHouse is apaid service, they are a bit mroe detail on the learning, but it can become overwhealming.
Yea, hus books
include*engine
@newtothat
do people read books about
Alvin
@AlvinW89
XD well his covers Html, CSS and he has another for JS and jQuery
include*engine
@newtothat
do you think reading books is useful or do you learn anything from books?
Devina
@Devina
@AlvinW89, the embedded YouTube video is a brilliant idea. It's a nice variation of a tribute page, a different concept but per