Skip to content

Commit

Permalink
Merge pull request #250 from masuilab/249_cors_text_api
Browse files Browse the repository at this point in the history
add CORS header for /(wiki)/(pagename)/text API
  • Loading branch information
masui committed Dec 1, 2015
2 parents 464d9f5 + d9dacf1 commit 4434152
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controllers/api.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
debug = require('debug')('gyazz:controller:api')
mongoose = require 'mongoose'
cors = require 'cors'
_ = require 'underscore'
async = require 'async'
PNG = require '../lib/png'
Expand Down Expand Up @@ -44,7 +45,7 @@ module.exports = (app) ->
data: list

# ページ内容取得 (apiとしてだけ)用意
app.get /^\/([^\/]+)\/(.*)\/(text|json)$/, (req, res) ->
app.get /^\/([^\/]+)\/(.*)\/(text|json)$/, cors(), (req, res) ->
wiki = req.params[0]
title = req.params[1]
ext = req.params[2]
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"coffee-script": "^1.7.1",
"coffeelint": "*",
"cookie-parser": "^1.0.1",
"cors": "^2.7.1",
"debug": "*",
"dotenv": "^1.2.0",
"express": "^4.4",
Expand Down

0 comments on commit 4434152

Please sign in to comment.