summaryrefslogtreecommitdiff
path: root/src/web.mjs
blob: 23ae5ffb3eb7b0dc6c93505d6659d415718591d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import * as u    from "./utils.mjs";
import * as hero from "./hero.mjs";

const listProducts = req => ({ status: 200 });
const getProduct   = req => ({ status: 200, body: "PRODUTO" });
const getSocket    = req => ({ status: 200, body: "SOCKET"  });


const server = hero.buildServer("papo", [
	[ "GET", "/api/products",     listProducts ],
	[ "GET", "/api/products/:id", getProduct   ],
	[ "GET", "/api/socket",       getSocket    ],
]);

export const app = async (...args) => {
	await server.listen(...args);
	hero.log.info({ type: "starting-server", args });
};