instant-meme
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -5,6 +5,8 @@ /** | ||
const {stripPNG} = require('../randomHelpers'); | ||
const fs = require('fs'); | ||
module.exports = async function (req) { | ||
const fileName = `${req.params.memeName}.json`; | ||
const memeName = stripPNG(req.params.memeName); | ||
const fileName = `${memeName}.json`; | ||
const json = await fs.promises.readFile(`instant-meme/templates/${fileName}`, 'utf-8'); | ||
@@ -11,0 +13,0 @@ let obj = JSON.parse(json); |
@@ -6,10 +6,3 @@ const express = require('express'); | ||
const commonHandlers = { | ||
e405: function(_req, res, _next) { | ||
res.status(405).send('This Api only accepts GET requests.'); | ||
}, | ||
e404: function (_req, res, _next) { | ||
res.status(404).send('File Not Found'); | ||
} | ||
}; | ||
const commonHandlers = require('./commonHandlers'); | ||
@@ -16,0 +9,0 @@ async function memeHandler(req, res, _next) { |
{ | ||
"name": "instant-meme", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "A express middleware to build 'memes' on the fly by specifying the image and text content in the url. Because photoshop is to slow for conversation.", | ||
@@ -34,2 +34,4 @@ "main": "index.js", | ||
"api/requestParser.js", | ||
"randomHelpers.js", | ||
"commonHandlers.js", | ||
"README.md" | ||
@@ -36,0 +38,0 @@ ], |
7490
7
85