Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var express = require('express'),
- azureMobileApps = require('azure-mobile-apps');
- // Set up a standard Express app
- var app = express();
- // If you are producing a combined Web + Mobile app, then you should handle
- // anything like logging, registering middleware, etc. here
- // Configuration of the Azure Mobile Apps can be done via an object, the
- // environment or an auxiliary file. For more information, see
- var users = [{email: 'a', pass: 'a'}];
- // Import the files from the tables directory to configure the /tables endpoint
- var mobileApp = azureMobileApps({
- // Explicitly enable the Azure Mobile Apps home page
- homePage: true,
- // Explicitly enable swagger support. UI support is enabled by
- // installing the swagger-ui npm module.
- //swagger: true
- });
- mobileApp.api.import('./api');
- app.post('/auth', function(req, res){
- var status = 401;
- var success = false;
- var user = verifyLogin(req.body.email, req.body.password);
- if(user){
- success = true;
- status = 200;
- }
- res.status(status).json(response);
- });
- //////////////////////////////////////////////////////////////
- function verifyLogin(email, pass){
- for(var i=0; i<users.length; i++){
- if(users[i].email == email && users[i].pass == pass){
- return true;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement