VueJS & PHP Api
I am 'new' to PHP so this question probably has a very obvious answer, so Ill apologize in advance.
Situation:
I am running a VueJS project, running it with npm run serve and then deploying it with npm run build to a laragon apache server with PHP 7 on it.
That all works great.
I am now moving from using our C# API which we have hosted and you hit it as a URL. To a PHP Api, this API is just set up with a straight connection to SQL using sqlsrv_connect. This is also working when I host it on apache/laragon in its own folder and hitting it on its own URL extension.
But what I was wanting to do ( and not sure if this is possible )
Is in my VueJS project put the .php files in a data folder and hit them like this fetch("srcdataGetSQLData.php?table=Clients&columns=top%2010ClientID"")
Is this possible, or should I rather have them hosted separately and use the URL method?
php vue.js vuejs2 fetch-api sqlsrv
add a comment |
I am 'new' to PHP so this question probably has a very obvious answer, so Ill apologize in advance.
Situation:
I am running a VueJS project, running it with npm run serve and then deploying it with npm run build to a laragon apache server with PHP 7 on it.
That all works great.
I am now moving from using our C# API which we have hosted and you hit it as a URL. To a PHP Api, this API is just set up with a straight connection to SQL using sqlsrv_connect. This is also working when I host it on apache/laragon in its own folder and hitting it on its own URL extension.
But what I was wanting to do ( and not sure if this is possible )
Is in my VueJS project put the .php files in a data folder and hit them like this fetch("srcdataGetSQLData.php?table=Clients&columns=top%2010ClientID"")
Is this possible, or should I rather have them hosted separately and use the URL method?
php vue.js vuejs2 fetch-api sqlsrv
add a comment |
I am 'new' to PHP so this question probably has a very obvious answer, so Ill apologize in advance.
Situation:
I am running a VueJS project, running it with npm run serve and then deploying it with npm run build to a laragon apache server with PHP 7 on it.
That all works great.
I am now moving from using our C# API which we have hosted and you hit it as a URL. To a PHP Api, this API is just set up with a straight connection to SQL using sqlsrv_connect. This is also working when I host it on apache/laragon in its own folder and hitting it on its own URL extension.
But what I was wanting to do ( and not sure if this is possible )
Is in my VueJS project put the .php files in a data folder and hit them like this fetch("srcdataGetSQLData.php?table=Clients&columns=top%2010ClientID"")
Is this possible, or should I rather have them hosted separately and use the URL method?
php vue.js vuejs2 fetch-api sqlsrv
I am 'new' to PHP so this question probably has a very obvious answer, so Ill apologize in advance.
Situation:
I am running a VueJS project, running it with npm run serve and then deploying it with npm run build to a laragon apache server with PHP 7 on it.
That all works great.
I am now moving from using our C# API which we have hosted and you hit it as a URL. To a PHP Api, this API is just set up with a straight connection to SQL using sqlsrv_connect. This is also working when I host it on apache/laragon in its own folder and hitting it on its own URL extension.
But what I was wanting to do ( and not sure if this is possible )
Is in my VueJS project put the .php files in a data folder and hit them like this fetch("srcdataGetSQLData.php?table=Clients&columns=top%2010ClientID"")
Is this possible, or should I rather have them hosted separately and use the URL method?
php vue.js vuejs2 fetch-api sqlsrv
php vue.js vuejs2 fetch-api sqlsrv
asked Nov 22 '18 at 13:06
Ross SummerellRoss Summerell
156
156
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Buddy,
Vuejs is a front-end framework.What it means is, When you do npm run build
then it will create bunch of js
and html/css/image
files on the server.Then you require a web server to server these files.
When you hit the url on your web-browser then all these files will download into
the web-browser and then execute over there.This is how front-end framework works in a nutshell.
PHP is a back-end scripting language.Which means it require back-end php engine to run and execute the code logic.So it has nothing to do with vuejs that is running on your web-browser.
Best possible way to connect these 2 applications is via API.You should request data from a php API which is running on back-end web server.
fetch('http://localhost/GetSQLData.php?table=Clients&columns=top%2010ClientID')
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431705%2fvuejs-php-api%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Buddy,
Vuejs is a front-end framework.What it means is, When you do npm run build
then it will create bunch of js
and html/css/image
files on the server.Then you require a web server to server these files.
When you hit the url on your web-browser then all these files will download into
the web-browser and then execute over there.This is how front-end framework works in a nutshell.
PHP is a back-end scripting language.Which means it require back-end php engine to run and execute the code logic.So it has nothing to do with vuejs that is running on your web-browser.
Best possible way to connect these 2 applications is via API.You should request data from a php API which is running on back-end web server.
fetch('http://localhost/GetSQLData.php?table=Clients&columns=top%2010ClientID')
add a comment |
Buddy,
Vuejs is a front-end framework.What it means is, When you do npm run build
then it will create bunch of js
and html/css/image
files on the server.Then you require a web server to server these files.
When you hit the url on your web-browser then all these files will download into
the web-browser and then execute over there.This is how front-end framework works in a nutshell.
PHP is a back-end scripting language.Which means it require back-end php engine to run and execute the code logic.So it has nothing to do with vuejs that is running on your web-browser.
Best possible way to connect these 2 applications is via API.You should request data from a php API which is running on back-end web server.
fetch('http://localhost/GetSQLData.php?table=Clients&columns=top%2010ClientID')
add a comment |
Buddy,
Vuejs is a front-end framework.What it means is, When you do npm run build
then it will create bunch of js
and html/css/image
files on the server.Then you require a web server to server these files.
When you hit the url on your web-browser then all these files will download into
the web-browser and then execute over there.This is how front-end framework works in a nutshell.
PHP is a back-end scripting language.Which means it require back-end php engine to run and execute the code logic.So it has nothing to do with vuejs that is running on your web-browser.
Best possible way to connect these 2 applications is via API.You should request data from a php API which is running on back-end web server.
fetch('http://localhost/GetSQLData.php?table=Clients&columns=top%2010ClientID')
Buddy,
Vuejs is a front-end framework.What it means is, When you do npm run build
then it will create bunch of js
and html/css/image
files on the server.Then you require a web server to server these files.
When you hit the url on your web-browser then all these files will download into
the web-browser and then execute over there.This is how front-end framework works in a nutshell.
PHP is a back-end scripting language.Which means it require back-end php engine to run and execute the code logic.So it has nothing to do with vuejs that is running on your web-browser.
Best possible way to connect these 2 applications is via API.You should request data from a php API which is running on back-end web server.
fetch('http://localhost/GetSQLData.php?table=Clients&columns=top%2010ClientID')
answered Nov 22 '18 at 13:37
Nuwan AttanayakeNuwan Attanayake
611414
611414
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431705%2fvuejs-php-api%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown