Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5 from AJRedDevil/develop
Browse files Browse the repository at this point in the history
API
  • Loading branch information
AjanShrestha authored Dec 22, 2019
2 parents 90854b2 + fefb563 commit 36486ec
Show file tree
Hide file tree
Showing 3 changed files with 423 additions and 0 deletions.
16 changes: 16 additions & 0 deletions api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const express = require('express');
const redis = require('redis'),
client = redis.createClient();
const {promisify} = require('util');
const getAsync = promisify(client.get).bind(client);

const app = express();
const port = 5000;

app.get('/', (req, res) => res.send('Jobs API!'));
app.get('/jobs', async (req, res) => {
const jobs = await getAsync('github');
return res.send(jobs);
});

app.listen(port, () => console.log(`Example app listening on port ${port}!`));
15 changes: 15 additions & 0 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "api",
"version": "0.1.0",
"description": "Express REST API",
"main": "index.js",
"author": "Ajan Lal Shrestha",
"license": "MIT",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"express": "4.17.1",
"redis": "2.8.0"
}
}
Loading

0 comments on commit 36486ec

Please sign in to comment.