Giter Club home page Giter Club logo

expressjs-example's Introduction

Express Example

Example of using Express to create a RESTful API with Node.js

How to understand this example

This example is based on the Jersey API example from TD#5. You are required to implement a service that exposes a RESTful API to list, add, update and delete user records from a database using Express and Node.js. You are provided with a reference implementation for a similar service that manages Todo lists. The reference code provided is under services/todo.js.

Instead of using Google App Engine for storage, this example uses mock storage services that export an API similar to TD#5's Store interface: getAll, get and save.

One way that this API differs, however, from TD#5's Store is that its functions are non-blocking: (i.e.) they return immediately without waiting for any underlying I/O ops to complete. Instead, these functions follow the JavaScirpt asynchronous tradition: they are all passed a callback function which will be called upon completion of the requested operation and passed any return values, including error flags/messages. Like in the assignment from TD#5, we provided you with the mock storage service for users, it is the node.js module found under stores/user.js.

Pre-requisites

Install Node.js and npm on your system.

To install on Ubuntu:

sudo apt-get install nodejs npm

To install on Windows or Mac OS X: Refer to https://nodejs.org/en/ for packaged installers.

Use npm to install dependencies (include Express)

cd path/to/clonned/git/repo
npm install

How to run:

node app.js

On Ubuntu:

nodejs app.js

expressjs-example's People

Contributors

mkatri avatar wangkekekexili avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.