Phonegap Error : 401 Unauthorized - consuming Rest API with Basic Auth in PhonegapBest Practices for securing a REST API / web serviceREST API error return good practicesUnderstanding REST: Verbs, error codes, and authenticationSecuring a Codeigniter Restful API accessed via AngularCodeIgniter Rest Server IntegrationCodeIgniter REST API Basic Authentication not workingcodeigniter rest api returns strange outputCodeigniter install rest api with composerPhonegap Rest API Only Working Second TimePhonegap App Works Fine On Browser But Throws Ajax Error When Runs On Mobile Devices

PC video game involving floating islands doing aerial combat

Whats the next step after commercial fusion reactors?

Why is c4 bad when playing the London against a King's Indian?

How can I instantiate a lambda closure type in C++11/14?

What happened to all the nuclear material being smuggled after the fall of the USSR?

Is it possible for people to live in the eye of a permanent hypercane?

Adding two lambda-functions in C++

Pay as you go Or Oyster card

Why does the Schrödinger equation work so well for the Hydrogen atom despite the relativistic boundary at the nucleus?

Their answer is discrete, mine is continuous. They baited me into the wrong answer. I have a P Exam question

Did thousands of women die every year due to illegal abortions before Roe v. Wade?

Does the "6 seconds per round" rule apply to speaking/roleplaying during combat situations?

Finding the constrain of integral

How do I calculate APR from monthly instalments?

How to generate random points without duplication?

Accidentally renamed tar.gz file to a non tar.gz file, will my file be messed up

Should I "tell" my exposition or give it through dialogue?

How is it possible that Gollum speaks Westron?

How is TD(0) method helpful? What good does it do?

Can a magnetic field of an object be stronger than its gravity?

Building a road to escape Earth's gravity by making a pyramid on Antartica

You've spoiled/damaged the card

What do we gain with higher order logics?

Payment instructions from HomeAway look fishy to me



Phonegap Error : 401 Unauthorized - consuming Rest API with Basic Auth in Phonegap


Best Practices for securing a REST API / web serviceREST API error return good practicesUnderstanding REST: Verbs, error codes, and authenticationSecuring a Codeigniter Restful API accessed via AngularCodeIgniter Rest Server IntegrationCodeIgniter REST API Basic Authentication not workingcodeigniter rest api returns strange outputCodeigniter install rest api with composerPhonegap Rest API Only Working Second TimePhonegap App Works Fine On Browser But Throws Ajax Error When Runs On Mobile Devices






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have create rest api in codeigniter and trying to consume it in phonegap app But its giving me Error - 401 Unauthorized in Phonegap index.html page.



I am using Token Based Authentication in codeigniter. Rest api is working fine in postman and also its working fine when rest api consumed in Codeigniter View using same ajax code



Codeigniter Rest Server Code I referenced -



https://github.com/chriskacerguis/codeigniter-restserver



Below is Error I'm Receiving in Phonegap's Index.html -



Phonegap App URL (http://192.168.1.2:3000/)



enter image description here



enter image description here



Below is Code I'm Using on Both Side in phonegap / Codeigniter View
URL (http://localhost/webapi/welcome/index)



 <script
src="http://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script>
var settings =
"async": true,
"crossDomain": true,
"url": "http://localhost/webapi/api/user/",
"method": "GET",
"headers":
"X-API-KEY": "7c4a8d09ca3762af61e59520943dc26494f8941b",
"Authorization": "Basic YWRtaW46MTIzNA==",
"cache-control": "no-cache",
"Postman-Token": "552d3078-6d54-4d59-ba79-c94248b154b3"


console.log("settings are -");
console.log(settings);
$.ajax(settings).done(function (response)
console.log("here api result come - ");
console.log(response);
);
</script>


Screenshot of Rest API Working fine in Postman -
enter image description here



Screenshot of COnsole When API Consumed in Codeigniter View using ajax -
enter image description here










share|improve this question
























  • Probably because you're firing the requests in postman from localhost, and the requests from phonegap go over the local network.

    – Jesse Schokker
    Mar 24 at 14:42











  • I tried again by closing postman but same error.

    – Heemanshu Bhalla
    Mar 24 at 14:45












  • This doesn't seem to be a CORS issue, since it doesn't straight up block the request. So my guess is that it's an issue within the PHP code

    – Jesse Schokker
    Mar 24 at 14:46











  • But when i tried in View of codeigniter (screenshot attached ) with same ajax code its returning output fine

    – Heemanshu Bhalla
    Mar 24 at 14:46












  • @JesseSchokker The codeigniter view where i consume api is on the same project as that of api so they are on same url but phonegap app is on differerent url. does this info has any significance.

    – Heemanshu Bhalla
    Mar 24 at 14:56

















0















I have create rest api in codeigniter and trying to consume it in phonegap app But its giving me Error - 401 Unauthorized in Phonegap index.html page.



I am using Token Based Authentication in codeigniter. Rest api is working fine in postman and also its working fine when rest api consumed in Codeigniter View using same ajax code



Codeigniter Rest Server Code I referenced -



https://github.com/chriskacerguis/codeigniter-restserver



Below is Error I'm Receiving in Phonegap's Index.html -



Phonegap App URL (http://192.168.1.2:3000/)



enter image description here



enter image description here



Below is Code I'm Using on Both Side in phonegap / Codeigniter View
URL (http://localhost/webapi/welcome/index)



 <script
src="http://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script>
var settings =
"async": true,
"crossDomain": true,
"url": "http://localhost/webapi/api/user/",
"method": "GET",
"headers":
"X-API-KEY": "7c4a8d09ca3762af61e59520943dc26494f8941b",
"Authorization": "Basic YWRtaW46MTIzNA==",
"cache-control": "no-cache",
"Postman-Token": "552d3078-6d54-4d59-ba79-c94248b154b3"


console.log("settings are -");
console.log(settings);
$.ajax(settings).done(function (response)
console.log("here api result come - ");
console.log(response);
);
</script>


Screenshot of Rest API Working fine in Postman -
enter image description here



Screenshot of COnsole When API Consumed in Codeigniter View using ajax -
enter image description here










share|improve this question
























  • Probably because you're firing the requests in postman from localhost, and the requests from phonegap go over the local network.

    – Jesse Schokker
    Mar 24 at 14:42











  • I tried again by closing postman but same error.

    – Heemanshu Bhalla
    Mar 24 at 14:45












  • This doesn't seem to be a CORS issue, since it doesn't straight up block the request. So my guess is that it's an issue within the PHP code

    – Jesse Schokker
    Mar 24 at 14:46











  • But when i tried in View of codeigniter (screenshot attached ) with same ajax code its returning output fine

    – Heemanshu Bhalla
    Mar 24 at 14:46












  • @JesseSchokker The codeigniter view where i consume api is on the same project as that of api so they are on same url but phonegap app is on differerent url. does this info has any significance.

    – Heemanshu Bhalla
    Mar 24 at 14:56













0












0








0


1






I have create rest api in codeigniter and trying to consume it in phonegap app But its giving me Error - 401 Unauthorized in Phonegap index.html page.



I am using Token Based Authentication in codeigniter. Rest api is working fine in postman and also its working fine when rest api consumed in Codeigniter View using same ajax code



Codeigniter Rest Server Code I referenced -



https://github.com/chriskacerguis/codeigniter-restserver



Below is Error I'm Receiving in Phonegap's Index.html -



Phonegap App URL (http://192.168.1.2:3000/)



enter image description here



enter image description here



Below is Code I'm Using on Both Side in phonegap / Codeigniter View
URL (http://localhost/webapi/welcome/index)



 <script
src="http://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script>
var settings =
"async": true,
"crossDomain": true,
"url": "http://localhost/webapi/api/user/",
"method": "GET",
"headers":
"X-API-KEY": "7c4a8d09ca3762af61e59520943dc26494f8941b",
"Authorization": "Basic YWRtaW46MTIzNA==",
"cache-control": "no-cache",
"Postman-Token": "552d3078-6d54-4d59-ba79-c94248b154b3"


console.log("settings are -");
console.log(settings);
$.ajax(settings).done(function (response)
console.log("here api result come - ");
console.log(response);
);
</script>


Screenshot of Rest API Working fine in Postman -
enter image description here



Screenshot of COnsole When API Consumed in Codeigniter View using ajax -
enter image description here










share|improve this question
















I have create rest api in codeigniter and trying to consume it in phonegap app But its giving me Error - 401 Unauthorized in Phonegap index.html page.



I am using Token Based Authentication in codeigniter. Rest api is working fine in postman and also its working fine when rest api consumed in Codeigniter View using same ajax code



Codeigniter Rest Server Code I referenced -



https://github.com/chriskacerguis/codeigniter-restserver



Below is Error I'm Receiving in Phonegap's Index.html -



Phonegap App URL (http://192.168.1.2:3000/)



enter image description here



enter image description here



Below is Code I'm Using on Both Side in phonegap / Codeigniter View
URL (http://localhost/webapi/welcome/index)



 <script
src="http://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script>
var settings =
"async": true,
"crossDomain": true,
"url": "http://localhost/webapi/api/user/",
"method": "GET",
"headers":
"X-API-KEY": "7c4a8d09ca3762af61e59520943dc26494f8941b",
"Authorization": "Basic YWRtaW46MTIzNA==",
"cache-control": "no-cache",
"Postman-Token": "552d3078-6d54-4d59-ba79-c94248b154b3"


console.log("settings are -");
console.log(settings);
$.ajax(settings).done(function (response)
console.log("here api result come - ");
console.log(response);
);
</script>


Screenshot of Rest API Working fine in Postman -
enter image description here



Screenshot of COnsole When API Consumed in Codeigniter View using ajax -
enter image description here







php rest phonegap codeigniter-restserver codeigniter-restapi






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 5:58







Heemanshu Bhalla

















asked Mar 24 at 14:41









Heemanshu BhallaHeemanshu Bhalla

2,39611538




2,39611538












  • Probably because you're firing the requests in postman from localhost, and the requests from phonegap go over the local network.

    – Jesse Schokker
    Mar 24 at 14:42











  • I tried again by closing postman but same error.

    – Heemanshu Bhalla
    Mar 24 at 14:45












  • This doesn't seem to be a CORS issue, since it doesn't straight up block the request. So my guess is that it's an issue within the PHP code

    – Jesse Schokker
    Mar 24 at 14:46











  • But when i tried in View of codeigniter (screenshot attached ) with same ajax code its returning output fine

    – Heemanshu Bhalla
    Mar 24 at 14:46












  • @JesseSchokker The codeigniter view where i consume api is on the same project as that of api so they are on same url but phonegap app is on differerent url. does this info has any significance.

    – Heemanshu Bhalla
    Mar 24 at 14:56

















  • Probably because you're firing the requests in postman from localhost, and the requests from phonegap go over the local network.

    – Jesse Schokker
    Mar 24 at 14:42











  • I tried again by closing postman but same error.

    – Heemanshu Bhalla
    Mar 24 at 14:45












  • This doesn't seem to be a CORS issue, since it doesn't straight up block the request. So my guess is that it's an issue within the PHP code

    – Jesse Schokker
    Mar 24 at 14:46











  • But when i tried in View of codeigniter (screenshot attached ) with same ajax code its returning output fine

    – Heemanshu Bhalla
    Mar 24 at 14:46












  • @JesseSchokker The codeigniter view where i consume api is on the same project as that of api so they are on same url but phonegap app is on differerent url. does this info has any significance.

    – Heemanshu Bhalla
    Mar 24 at 14:56
















Probably because you're firing the requests in postman from localhost, and the requests from phonegap go over the local network.

– Jesse Schokker
Mar 24 at 14:42





Probably because you're firing the requests in postman from localhost, and the requests from phonegap go over the local network.

– Jesse Schokker
Mar 24 at 14:42













I tried again by closing postman but same error.

– Heemanshu Bhalla
Mar 24 at 14:45






I tried again by closing postman but same error.

– Heemanshu Bhalla
Mar 24 at 14:45














This doesn't seem to be a CORS issue, since it doesn't straight up block the request. So my guess is that it's an issue within the PHP code

– Jesse Schokker
Mar 24 at 14:46





This doesn't seem to be a CORS issue, since it doesn't straight up block the request. So my guess is that it's an issue within the PHP code

– Jesse Schokker
Mar 24 at 14:46













But when i tried in View of codeigniter (screenshot attached ) with same ajax code its returning output fine

– Heemanshu Bhalla
Mar 24 at 14:46






But when i tried in View of codeigniter (screenshot attached ) with same ajax code its returning output fine

– Heemanshu Bhalla
Mar 24 at 14:46














@JesseSchokker The codeigniter view where i consume api is on the same project as that of api so they are on same url but phonegap app is on differerent url. does this info has any significance.

– Heemanshu Bhalla
Mar 24 at 14:56





@JesseSchokker The codeigniter view where i consume api is on the same project as that of api so they are on same url but phonegap app is on differerent url. does this info has any significance.

– Heemanshu Bhalla
Mar 24 at 14:56












1 Answer
1






active

oldest

votes


















0














Basically, you won't be able to access http://localhost/webapi/api/user/ from your emulator as your XAMPP server is hosted on a different machine (the emulator is a virtual machine). By changing the URL of your request to http://192.168.1.61/webapi/api/user/ for example, you can access the apache server hosted on your PC. You'll have to find out your local IP by opening a command prompt and typing ipconfig. You'll also need to ensure that your networks firewall allows incoming traffic from port 80.



Or you can try on cpanel or plesk server.






share|improve this answer























  • i think url in answer is wrong '192.168.1.61' ? Changing API Url to 192.168.1.2/webapi/api/user also didn't helped

    – Heemanshu Bhalla
    Mar 24 at 16:09












  • Yes, this simple url. you can check ip on xampp

    – E. ÇAPAN
    Mar 24 at 16:10












  • yes i tried placing my ip in place of localhost with / without port it didn't worked

    – Heemanshu Bhalla
    Mar 24 at 16:13











  • Are you can try POST method.

    – E. ÇAPAN
    Mar 24 at 16:15











  • I can try but my requirement is to get records. I think there is some problem in getting it throught ajax with basic auth. Because its working fine when i used same ajax code in codeigniter view

    – Heemanshu Bhalla
    Mar 24 at 16:21












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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55324927%2fphonegap-error-401-unauthorized-consuming-rest-api-with-basic-auth-in-phoneg%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









0














Basically, you won't be able to access http://localhost/webapi/api/user/ from your emulator as your XAMPP server is hosted on a different machine (the emulator is a virtual machine). By changing the URL of your request to http://192.168.1.61/webapi/api/user/ for example, you can access the apache server hosted on your PC. You'll have to find out your local IP by opening a command prompt and typing ipconfig. You'll also need to ensure that your networks firewall allows incoming traffic from port 80.



Or you can try on cpanel or plesk server.






share|improve this answer























  • i think url in answer is wrong '192.168.1.61' ? Changing API Url to 192.168.1.2/webapi/api/user also didn't helped

    – Heemanshu Bhalla
    Mar 24 at 16:09












  • Yes, this simple url. you can check ip on xampp

    – E. ÇAPAN
    Mar 24 at 16:10












  • yes i tried placing my ip in place of localhost with / without port it didn't worked

    – Heemanshu Bhalla
    Mar 24 at 16:13











  • Are you can try POST method.

    – E. ÇAPAN
    Mar 24 at 16:15











  • I can try but my requirement is to get records. I think there is some problem in getting it throught ajax with basic auth. Because its working fine when i used same ajax code in codeigniter view

    – Heemanshu Bhalla
    Mar 24 at 16:21
















0














Basically, you won't be able to access http://localhost/webapi/api/user/ from your emulator as your XAMPP server is hosted on a different machine (the emulator is a virtual machine). By changing the URL of your request to http://192.168.1.61/webapi/api/user/ for example, you can access the apache server hosted on your PC. You'll have to find out your local IP by opening a command prompt and typing ipconfig. You'll also need to ensure that your networks firewall allows incoming traffic from port 80.



Or you can try on cpanel or plesk server.






share|improve this answer























  • i think url in answer is wrong '192.168.1.61' ? Changing API Url to 192.168.1.2/webapi/api/user also didn't helped

    – Heemanshu Bhalla
    Mar 24 at 16:09












  • Yes, this simple url. you can check ip on xampp

    – E. ÇAPAN
    Mar 24 at 16:10












  • yes i tried placing my ip in place of localhost with / without port it didn't worked

    – Heemanshu Bhalla
    Mar 24 at 16:13











  • Are you can try POST method.

    – E. ÇAPAN
    Mar 24 at 16:15











  • I can try but my requirement is to get records. I think there is some problem in getting it throught ajax with basic auth. Because its working fine when i used same ajax code in codeigniter view

    – Heemanshu Bhalla
    Mar 24 at 16:21














0












0








0







Basically, you won't be able to access http://localhost/webapi/api/user/ from your emulator as your XAMPP server is hosted on a different machine (the emulator is a virtual machine). By changing the URL of your request to http://192.168.1.61/webapi/api/user/ for example, you can access the apache server hosted on your PC. You'll have to find out your local IP by opening a command prompt and typing ipconfig. You'll also need to ensure that your networks firewall allows incoming traffic from port 80.



Or you can try on cpanel or plesk server.






share|improve this answer













Basically, you won't be able to access http://localhost/webapi/api/user/ from your emulator as your XAMPP server is hosted on a different machine (the emulator is a virtual machine). By changing the URL of your request to http://192.168.1.61/webapi/api/user/ for example, you can access the apache server hosted on your PC. You'll have to find out your local IP by opening a command prompt and typing ipconfig. You'll also need to ensure that your networks firewall allows incoming traffic from port 80.



Or you can try on cpanel or plesk server.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 24 at 15:59









E. ÇAPANE. ÇAPAN

12




12












  • i think url in answer is wrong '192.168.1.61' ? Changing API Url to 192.168.1.2/webapi/api/user also didn't helped

    – Heemanshu Bhalla
    Mar 24 at 16:09












  • Yes, this simple url. you can check ip on xampp

    – E. ÇAPAN
    Mar 24 at 16:10












  • yes i tried placing my ip in place of localhost with / without port it didn't worked

    – Heemanshu Bhalla
    Mar 24 at 16:13











  • Are you can try POST method.

    – E. ÇAPAN
    Mar 24 at 16:15











  • I can try but my requirement is to get records. I think there is some problem in getting it throught ajax with basic auth. Because its working fine when i used same ajax code in codeigniter view

    – Heemanshu Bhalla
    Mar 24 at 16:21


















  • i think url in answer is wrong '192.168.1.61' ? Changing API Url to 192.168.1.2/webapi/api/user also didn't helped

    – Heemanshu Bhalla
    Mar 24 at 16:09












  • Yes, this simple url. you can check ip on xampp

    – E. ÇAPAN
    Mar 24 at 16:10












  • yes i tried placing my ip in place of localhost with / without port it didn't worked

    – Heemanshu Bhalla
    Mar 24 at 16:13











  • Are you can try POST method.

    – E. ÇAPAN
    Mar 24 at 16:15











  • I can try but my requirement is to get records. I think there is some problem in getting it throught ajax with basic auth. Because its working fine when i used same ajax code in codeigniter view

    – Heemanshu Bhalla
    Mar 24 at 16:21

















i think url in answer is wrong '192.168.1.61' ? Changing API Url to 192.168.1.2/webapi/api/user also didn't helped

– Heemanshu Bhalla
Mar 24 at 16:09






i think url in answer is wrong '192.168.1.61' ? Changing API Url to 192.168.1.2/webapi/api/user also didn't helped

– Heemanshu Bhalla
Mar 24 at 16:09














Yes, this simple url. you can check ip on xampp

– E. ÇAPAN
Mar 24 at 16:10






Yes, this simple url. you can check ip on xampp

– E. ÇAPAN
Mar 24 at 16:10














yes i tried placing my ip in place of localhost with / without port it didn't worked

– Heemanshu Bhalla
Mar 24 at 16:13





yes i tried placing my ip in place of localhost with / without port it didn't worked

– Heemanshu Bhalla
Mar 24 at 16:13













Are you can try POST method.

– E. ÇAPAN
Mar 24 at 16:15





Are you can try POST method.

– E. ÇAPAN
Mar 24 at 16:15













I can try but my requirement is to get records. I think there is some problem in getting it throught ajax with basic auth. Because its working fine when i used same ajax code in codeigniter view

– Heemanshu Bhalla
Mar 24 at 16:21






I can try but my requirement is to get records. I think there is some problem in getting it throught ajax with basic auth. Because its working fine when i used same ajax code in codeigniter view

– Heemanshu Bhalla
Mar 24 at 16:21


















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55324927%2fphonegap-error-401-unauthorized-consuming-rest-api-with-basic-auth-in-phoneg%23new-answer', 'question_page');

);

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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript