This repository has been archived by the owner on Jul 19, 2023. It is now read-only.
-
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.
Merge pull request #5 from AJRedDevil/develop
API
- Loading branch information
Showing
3 changed files
with
423 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,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}!`)); |
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": "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" | ||
} | ||
} |
Oops, something went wrong.