Created
April 24, 2019 13:58
-
-
Save zaiste/4450aab307ce8f28d1af1d80278c837f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const Szelmostwo = require('./'); | |
const { ok, json, created } = require('./response'); | |
const app = new Szelmostwo(); | |
app.get('/', async ({ params }) => `Hello, uWS -> ${JSON.stringify(params)}`); | |
app.get('/throw', async ({ params }) => { | |
// | |
throw 'Bajlango'; | |
}); | |
app.get('/ok', async ({ params }) => created('yep')); | |
app.get('/json', async ({ params }) => json({ a: 1 })); | |
app.post( | |
'/post', | |
async ({ params }) => `Hello, Post -> ${JSON.stringify(params)}` | |
); | |
app.get( | |
'/name/:name', | |
async ({ params }) => `Hello, ${JSON.stringify(params)}` | |
); | |
app.get( | |
'/jak/:name/boo/:search', | |
async ({ params }) => `Hello, ${JSON.stringify(params)}` | |
); | |
app.post('/upload', request => { | |
return `Hello File! ${Buffer.from(request.files.upload.data).toString()}`; | |
}); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment