forked from DylanVann/react-native-fast-image
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit 7eb051a.
- Loading branch information
Til Wessel
authored and
Til Wessel
committed
Mar 14, 2018
1 parent
c810814
commit 26042d4
Showing
81 changed files
with
11,326 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const path = require('path') | ||
const express = require('express') | ||
const bodyParser = require('body-parser') | ||
const morgan = require('morgan') | ||
|
||
const app = express() | ||
|
||
const port = process.env.PORT || 8080 | ||
const welcome = 'Test images API at http://localhost:' + port | ||
console.log(welcome) | ||
|
||
app.use(bodyParser.urlencoded({ extended: false })) | ||
app.use(bodyParser.json()) | ||
app.use(morgan('dev')) | ||
app.get('/', (req, res) => res.send(welcome)) | ||
app.listen(port) | ||
|
||
const authentication = (req, res, next) => { | ||
const token = req.query.token || req.headers['token'] | ||
if (token) { | ||
next() | ||
} else { | ||
return res.status(403).send({ success: false }) | ||
} | ||
} | ||
|
||
const staticPictures = express.static(path.join(__dirname, 'pictures')) | ||
|
||
app.use('/pictures', authentication, staticPictures) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "react-native-fast-image-example-server", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "nodemon ./index" | ||
}, | ||
"dependencies": { | ||
"body-parser": "^1.17.1", | ||
"express": "^4.15.2", | ||
"morgan": "^1.8.1", | ||
"nodemon": "^1.11.0" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.