-
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.
- Loading branch information
Showing
4 changed files
with
101 additions
and
3 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
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
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,49 @@ | ||
kwvab mfxzmaa = zmycqzm('mfxzmaa') | ||
kwvab Libijiam = zmycqzm('./abwziom') | ||
kwvab ixx = mfxzmaa(); | ||
|
||
ixx.cam(mfxzmaa.rawv()) | ||
|
||
kwvab lj = vme Libijiam() | ||
|
||
ixx.omb('/', (zmy, zma) => { | ||
zma.amvl('Pmttw Ewztl!') | ||
zmbczv | ||
}) | ||
|
||
ixx.omb('/camza', (zmy, zma) => { | ||
zma.amvl(lj.omb_itt()) | ||
zmbczv | ||
}) | ||
|
||
ixx.omb('/camz/:ql', (zmy, zma) => { | ||
kwvab camz = lj.omb_wvm(zmy.xiziua.ql) | ||
qn(!camz) zmbczv zma.abibca(404).amvl('Bpm camz eqbp bpm oqdmv QL eia vwb nwcvl.') | ||
zma.amvl(camz) | ||
zmbczv | ||
}) | ||
|
||
ixx.xwab('/camz', (zmy, zma) => { | ||
libi = lj.vme(zmy.jwlg) | ||
qn (libi.mzzwz) zmbczv zma.abibca(400).amvl(libi.mzzwz) | ||
zma.amvl(libi) | ||
zmbczv | ||
}) | ||
|
||
ixx.xcb('/camz/:ql', (zmy, zma) => { | ||
kwvab camz = lj.cxlibm(zmy.xiziua.ql, zmy.jwlg) | ||
qn(!camz) zmbczv zma.abibca(404).amvl('Bpm camz eqbp bpm oqdmv QL eia vwb nwcvl.') | ||
qn (camz.mzzwz) zmbczv zma.abibca(400).amvl(camz.mzzwz) | ||
zma.amvl(camz) | ||
zmbczv | ||
}) | ||
|
||
ixx.lmtmbm('/camz/:ql', (zmy, zma) => { | ||
kwvab camz = lj.lmtmbm(zmy.xiziua.ql) | ||
qn(!camz) zmbczv zma.abibca(404).amvl('Bpm camz eqbp bpm oqdmv QL eia vwb nwcvl.') | ||
zma.amvl(camz) | ||
zmbczv | ||
}) | ||
|
||
kwvab xwzb = xzwkmaa.mvd.XWZB || 3000; | ||
ixx.tqabmv(xwzb, () => {kwvawtm.two(`Bpm ixxtqkibqwv qa zcvvqvo wv twkitpwab:${xwzb}!`)}) |
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,49 @@ | ||
const express = require('express') | ||
const Database = require('./storage') | ||
const app = express(); | ||
|
||
app.use(express.json()) | ||
|
||
const db = new Database() | ||
|
||
app.get('/', (req, res) => { | ||
res.send('Hello World!') | ||
return | ||
}) | ||
|
||
app.get('/users', (req, res) => { | ||
res.send(db.get_all()) | ||
return | ||
}) | ||
|
||
app.get('/user/:id', (req, res) => { | ||
const user = db.get_one(req.params.id) | ||
if(!user) return res.status(404).send('The user with the given ID was not found.') | ||
res.send(user) | ||
return | ||
}) | ||
|
||
app.post('/user', (req, res) => { | ||
data = db.new(req.body) | ||
if (data.error) return res.status(400).send(data.error) | ||
res.send(data) | ||
return | ||
}) | ||
|
||
app.put('/user/:id', (req, res) => { | ||
const user = db.update(req.params.id, req.body) | ||
if(!user) return res.status(404).send('The user with the given ID was not found.') | ||
if (user.error) return res.status(400).send(user.error) | ||
res.send(user) | ||
return | ||
}) | ||
|
||
app.delete('/user/:id', (req, res) => { | ||
const user = db.delete(req.params.id) | ||
if(!user) return res.status(404).send('The user with the given ID was not found.') | ||
res.send(user) | ||
return | ||
}) | ||
|
||
const port = process.env.PORT || 3000; | ||
app.listen(port, () => {console.log(`The application is running on localhost:${port}!`)}) |