Motyar

@motyar

Freelance Web Developer

Static Web Hosting, made easy

Aug 20, 2014

REST APIs for your MEAN Stack Application

You can use JavaScript throughout your stack. This is called  MEAN stack:­ MongoDB, ExpressJS, AngularJS, and Node.js.

MongoDB as Database, ExpressJS for routing and HTTP server, All logic on beckend in Node.js, and AngularJS on front end to Handle REST APIs and Client side routing. 

In this post we are going to write the beck-end part for a simple MEAN stack app, REST APIs to handle data.

Pandas in bamboo farm

REST API using NodeJS, Express and MongoDB.

Installation

You must have MongoDB and NodeJS installted on your server.


    git clone https://github.com/motyar/rest_api_mean
    cd rest_api_mean
    npm install
    node server.js

Nothing but (cute) Pandas

GET /api/pandas to get all the pandas.
GET /api/pandas/panda_id to get that panda's info
POST /api/pandas to add new panda
DELETE /api/pandas/panda_id to remove that one panda.
PUT /api/pandas/panda_id to update details

Tools

You can use HurlIt to test REST APIs.

 

Whats next?

Stay tuned, we will be working on front end of this app, using AngularJS.

 

You can hire me for your next fullstack JavaScript application, I am available

Labels: , , , ,




By :