Experiment on how working with deno as a REST-API might look like.
Check out https://eveningkid.com/denodb-docs/docs/getting-started
Check out https://deno.land/x/djwt
https://raw.githubusercontent.com/sroehrl/deno-rest-api/master/mod.ts
import {ClientRequest, Method, startSimpleServer} from 'https://raw.githubusercontent.com/sroehrl/deno-rest-api/master/mod.ts';
startSimpleServer([
{
path:'/api/test',
method:Method.GET,
handler:() => ({test:'me'})
},
{
path: '/api/read-parmas/:name',
method: Method.GET,
handler: (client: ClientRequest) => ({name:client.params.name})
},
{
path: '/api/yes-or-no',
method: Method.POST,
handler: (client: ClientRequest) => {
const answer = {
approval: client.body.approval === 'yes' ? 'yes' : 'no'
}
return answer;
}
}
])
deno run --allow-net --allow-read --allow-write --watch {your-file.ts}