michaelneu / webxcel

🤔 A REST backend built with plain VBA Microsoft Excel macros. Yes. Macros.
https://dev.to/michaelneu/to-vba-and-beyond---building-a-restful-backend-using-plain-microsoft-excel-macros-76n
MIT License
440 stars 70 forks source link

Example Project doesn't work out of the box #12

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hi! I saw that issue #8 was up for grabs. I want to work on that, but I got stuck trying to run the example. Chrome does not like the example app because of the CORS policy. I can't run index.html from a file:/// url, so I copied the files to a local instance of xampp, but that still doesn't work because xampp is on port 80 and webxcel is on port 8080. I even changed the URLs used in app.jsx to use the other port, that gets blocked CORS policy too. Fortunately the console said it would work if the server replied with a Access-Control-Allow-Origin header. I added that to the HTTPResponse class, and I was able to GET items when the page loaded, but PUT and DELETEs failed. It looks like I'm stuck because the browser is expecting the server to deal with the HTTP OPTIONS method. @michaelneu how have you configured your environment to work around this?

ghost commented 5 years ago

I know chrome has a command line option that disables CORS policy checks, and it works if I do that. However that's not an answer to this issue because the urls in app.jsx still had to be changed.

michaelneu commented 5 years ago

Sorry for the delay and thanks for looking into this!

Webxcel actually contains a static file server (which should be enabled in the example project iirc), so if you navigate to http://localhost:8080/index.html, it should display the example app. The reason it doesn't automatically redirect you to index.html is, that webxcel doesn't do directory listings to search for a sane index page. I've added an issue for that (#14). I'll hopefully find the time to look into this soon. In the meantime, you'll have to append /index.html to the url.

Could you please check if that works for you?

ghost commented 5 years ago

Yes, thank you, that did the trick! I ironically think this project is brilliant, and I'd like to show it to some friends in college who are learning about designing web apps. Webxcel is a fantastic solution for beginners to mock-up a back-end without needing any technical knowledge (or time invested) of how to set-up a database. I've made a few small changes to the readme to help out beginners. I'll submit a PR shortly and link it to #14