fduch2k / azure-mobile-apps-node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Azure Mobile Apps - Node SDK

This package is still in development! This software is still likey to change dramatically and have minimal documentation prior to official release. Use caution before using this in a production application.

The Azure Mobile Apps Node.js SDK is an express middleware package which makes it easy to create a backend for your mobile application and get it running on Azure.

var app = require('express')(); // Create an instance of an Express app
var mobileApp = require('azure-mobile-apps')(); // Create an instance of a Mobile App with default settings

mobileApp.tables.add('TodoItem'); // Create a Table for 'TodoItem' with all default settings

app.use(mobileApp);
app.listen(process.env.PORT || 3000);

Installation

npm install --save azure/azure-mobile-apps-node

"dependencies": {
  "azure-mobile-apps":"azure/azure-mobile-apps-node"
}

An official npm package will be published soon.

Documentation & Resources

Quickstart

  1. Create a new directory, initialize git, and initialize npm

mkdir quickstart

git init

npm init

  1. Install (with npm) the azure-mobile-apps and express packages

npm install express azure/azure-mobile-apps-node --save

  1. Create a server.js file and add the following code to the file:
var app = require('express')(); // Create an instance of an Express app
var mobileApp = require('azure-mobile-apps')(); // Create an instance of a Mobile App with default settings

mobileApp.tables.add('TodoItem'); // Create a Table for 'TodoItem' with all default settings

app.use(mobileApp);
app.listen(process.env.PORT || 3000);
  1. Run your project locally with node server.js

  2. Publish your project to an existing Azure Mobile App by adding it as a remote and pushing your changes.

git remote add azure https://{user}@{sitename}.scm.azurewebsites.net:443/{sitename}.git

git add package.json server.js

git commit -m 'Quickstart created'

git push azure master

For steps 4-5, you can use any of the clients found in the Client & Server Quickstarts to test.

Contributing

For information on how to contribute to this project, please see the contributor guide.

License

MIT

About

License:Other


Languages

Language:JavaScript 100.0%