api: add web server & patch package.json's scripts

Pedro Lucas Porcellis porcellis@eletrotupi.com 3 months ago 90a378e3e8b3436b9a12b049e6ae1d9ff93a828b
Parents: 1aeaa80
2 file(s) changed
  • api/package.json +2 -1
  • api/src/app.js +5 -0
api/package.json
@@ -3,13 +3,14 @@ "name": "api",
3 3 "version": "1.0.0",
4 4 "description": "",
5 5 "license": "ISC",
6 - "author": "",
6 + "author": "Pedro Lucas Porcellis <porcellis@eletrotupi.com>",
7 7 "type": "module",
8 8 "main": "src/index.js",
9 9 "directories": {
10 10 "test": "tests"
11 11 },
12 12 "scripts": {
13 + "start": "node src/app.js",
13 14 "test": "npx ava"
14 15 },
15 16 "dependencies": {
api/src/app.js
@@ -1,6 +1,11 @@
1 1 import { createApp } from "./create-app.js";
2 2 import db from "./db.js";
3 3
4 + const port = process.env.PORT || '3000'
4 5 const app = createApp(db);
6 +
7 + app.listen(port, () => {
8 + console.log(`App running on ${port}`)
9 + })
5 10
6 11 export default app;