Skip to content

Possible problem while running the project locally #2

Closed

Description

@duaraghav8

I cloned the project and fired up the index.html. The environment loads, but the Data doesn't because the browser's Cross Origin Security Policy blocks it from loading.

So I wrote a simple Node Script which can be used as the entry point of the server instead.
So instead of launching index.html, people can launch the Script and get http://localhost:8080, then everything works flawlessly.
shot

The script (stays in the root directory) is:

server.js

process.chdir (__dirname);

var app = require ('express') (),
    serveStatic = require ('serve-static');

app
    .use (serveStatic (__dirname))
    .listen (process.env.NODE_ENV || 8080, function () {
        console.log ('Ready');
    });

Do you think it will be a good idea to upload the above server.js & Package.json on this repository for the ease of others?

Activity

  1. 64json commented on May 22, 2016

    @64json
    Member

    Oops I had never tested locally on Chrome.
    Thank you for reporting this significant issue.
    I guess it looks weird if I add Node.js files into this repo.
    Instead, I found a proper repo behaving in the same way as you suggest.
    https://github.com/indexzero/http-server
    I will inform this in README.md.

  2. duaraghav8 commented on May 22, 2016

    @duaraghav8
    MemberAuthor

    You're welcome:)
    Ah! I agree, the http-server utility is a more sensible solution.

  3. 64json commented on May 22, 2016

    @64json
    Member

    Check out the new README.md 👍

  4. added a commit that references this issue on May 27, 2016
  5. added a commit that references this issue on Jul 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions