Giter Site home page Giter Site logo

lamalizrok-server's Introduction

<<<<<<< HEAD

misterBIT-simple-rest-server

install and use

install : clone/download

npm install

start:

npm start

Use

supported REST verbs - POST,PUT,GET,DELETE

point your app to use localhost:3003/data/

where collectionName is whatever object you want to save for example users

CORS is enabled for all routes so you can come from any domain.

POST localhost:3003/data/user ----> adds a user (from json in body) -->returns the new user ID (in an object)

GET localhost:3003/data/user -----> gets the list of users

GET localhost:3003/data/user/ -----> returns a single user by its ID from the list of users or undefined

PUT localhost:3003/data/user/ -----> replaces a single user by its ID in the list of users with the JSON data in the body

DELETE localhost:3003/data/user/ -----> deletes a single user by its ID off the list of users

3 Versions of the server:

  1. in-memory, based on files

  2. MongoDB

  3. Configured with Socket.io

Use with Anuglar 2 - notice students of angular workshop

make sure your user service issues the POST request with the right content-type header (json), else the user data will not be added to the store eg: (from my saveUser function)

...
return this.http.post(url, JSON.stringify(user), {headers: new Headers({'content-type':'application/json'})});

Headers is an exported class in the @angular/http package

Demos

the server comes with cars,pets and monsters collections

Reset the data store

just restart the server

Notes

For development purposes only!!! if you need something more advance, with abilities to configure routes, save the in-memory data to disk etc use json-server

LamaLizrok-server

74052f7742430e0defbf0e001f12d83e260ee14a

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.