Skip to content

Instantly share code, notes, and snippets.

@zaiste
Created April 24, 2019 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaiste/4450aab307ce8f28d1af1d80278c837f to your computer and use it in GitHub Desktop.
Save zaiste/4450aab307ce8f28d1af1d80278c837f to your computer and use it in GitHub Desktop.
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