Closed jaseew01 closed 9 years ago
It is important how you open the file up in your browser. If you do it as a "file", so the location bar says something like: "file:///folders/path/to/the/file.html", then it's not going to work. You need to be accessing the file with the "localhost" thing, and the same port that your server is listening on. In particular, you need to adjust your server to make it serve that file on an "index.html" request.
If you are using Chrome and you open the Console and go to the Network tab, then when you refresh the page and try to submit etc it will show you what it's trying to do and why it failed. Might help zero in on the problem.
Could you take a look at that commit that I just made? I am having trouble connecting to my SQLite Database. I am doing something wrong, and I haven't been able to figure out what it is.
It's hard for me to troubleshoot that, as I cannot run mssql. Have you been able to pinpoint the error you are getting? Console.log every stage, especially around that connectDB function.
So is your database sqlite or mssql?
It is sqlite
Ok then this might be the problem, as you are still using sql = require('mssql')
which would presumably only work with a mssql database, so you probably need to instead get a module for sqlite. Do a google search for "sqlite node", should give you some hits, e.g. https://github.com/mapbox/node-sqlite3 if you're using sqlite3.
got it, sorry I just assumed that the mssql package could be used for sqlite databases as well.
Okay, with the last commit, I created a MySQL, not SQLite database. When I try and connect, the connection is timing out. The error is code: ETIMEOUT, the message is: failed to connect to JASEEW93: undefined in 1500ms. I have been messing with it for the past 24 hours and have made very little if not any progress on it. Any idea what is going on?
That "undefined" part worries me a bit. Clearly isn't finding the database though. And I assume you were running the mssql server at the same time?
Are you sure you should be using "JASEEW93" as the "server name", rather than the local ip address?
Let's take a look at it tomorrow.
Okay, sounds good.
Can you take a look at app.get('file/:fileid/download, function...)? Is their a way to construct a file within this method to send back?
Well a "file" is really nothing more than the contents of an HTTP request, with an appropriate MIME content type, I think. Look into MIME and the Content-Type attribute, it would essentially tell the browser how to handle the information it gets back. A little bit like how you get the JSON file now when you go to your start page? The browser just automatically downloads it instead of showing it to you.
Okay, thanks I will take a look at that.
I am still having problems hitting my post method from my browser. Just to make sure I am going about it the correct way, this is what I am doing: