api: add web server & patch package.json's scripts
Pedro Lucas Porcellis porcellis@eletrotupi.com · 7 months ago
90a378e3e8b3436b9a12b049e6ae1d9ff93a828b Browse filesParents
1aeaa80Changed files
2
Additions
+7
Deletions
-1
api/package.json
1 1
{
2 2
"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": {
16 17
"bcryptjs": "^3.0.3",
17 18
"better-sqlite3": "^12.5.0",
21 22
"devDependencies": {
22 23
"ava": "^6.4.1",
23 24
"supertest": "^7.1.4"
24 25
}
25 26
}
api/src/app.js
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;