Cors Lite

Serving JSON using CORS with JSONP fallback
Alternatives To Cors Lite
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Nginx Tutorial3,032
7 months ago5cc-by-sa-4.0JavaScript
这是一个 Nginx 极简教程,目的在于帮助新手快速入门 Nginx。
Java Sec Code2,004
2 months ago21Java
Java web common vulnerabilities and security code which is base on springboot and spring security
Allorigins591
8 months ago28mitJavaScript
:alien: Pull content from any page as JSON via API
Cross Origin573
9 months agon,ullJavaScript
A collection of simple demos of CORS
Instagram Proxy Api239
5 years agoJavaScript
CORS compliant API to access Instagram's public data
Ajaxdemo89
5 years agoJavaScript
给公司同事和合作方详细讲解ajax的跨域访问的来龙去脉demo
Web Api The Good Parts76
5 years ago
《Web API的设计与开发》--知识点整理
Koa2 Cet63
6 years ago4HTML
English-querying system for Grade 4 and Grade 6 with free api interface,based on angular and koa2
Vanilla Api48
6 years agomitPHP
Extensible RESTful API shim for Vanilla that operates in JSON or XML with support for JSONP and CORS
Cors Tutorial44
4 years ago1mitPython
Use Django To Introduce CORS and Same-Origin Policy
Alternatives To Cors Lite
Select To Compare


Alternative Project Comparisons
Readme

Cors-lite

This is a node program that allows for easy serving of JSON data using CORS with a fallback to JSONP.

The primary use case is a site that is semi-static in its JSON needs.

Install

You need node installed. Go to

  1. Install node if not already installed. v.06.17 or higher is recommended.
  2. Run node server at the command line: node server
  3. Visit localhost:3000 to check that the server is up and running.
  4. Modify paths variable at top of server file to point to your JSON files of interest. Restart server and check. The hash is of the form path : url where the path is where the server expects a request to come from and the url is where the JSON data actually lives.

Using JSON

Check out this live working version: http://jsbin.com/epadoh/1/edit#javascript,html

Use IECors.js to use for IE8 (maybe IE9) as at http://jsbin.com/erugun/2/edit#javascript,html,live

One may also want to read: kendoui

Two useful code snippets using jQuery:

JSON via CORS:

$.get("http://simplejsonp.nodester.com/thomaspark/bootswatch", function (a, b, c) {d = [a, b, c]}, "json")

JSONP:

$.get("http://simplejsonp.nodester.com/thomaspark/bootswatch", function (a, b, c) {d = [a, b, c]}, "jsonp")

If you go to any page with jQuery on it (such as this very page) and use your web console, you can run this code and check out the results in the global variable d. Obviously, one should replace the anonymous functions with something much better.

This project was initiated to provide an API for the semi-static fantastic bootswatch project.

Hosting

You should be able to host the server on any node service.

I use nodester and the steps can be as easy as:

  1. Clone this repo
  2. Modify the path hash
  3. git push it to nodester.
  4. You may need to npm intall request using the nodester command line tool.
  5. Done. See http://nodester.com for actual commands and stuff. You also need to get added to the service.

There is also nodejitsu and CloudFoundry

Nodester aims to always be free while the others are in free beta with no mention of pricing.

Disclaimer

This has nothing to do with beverages. Just a descriptive name that is also a playful parody on a certain well-known beverage.

Licensed under MIT license.

Copyright (c) 2012, James Taylor, jostylr/cors-lite

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Popular Jsonp Projects
Popular Cors Projects
Popular Application Programming Interfaces Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Node
Json
Cors
Json Data
Jsonp