forked from ericpkatz/acme-shopping
-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
27 lines (20 loc) · 845 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const express = require("express");
const favicon = require("serve-favicon");
const path = require("path");
const app = express();
app.use(express.json());
app.use(favicon(path.join(__dirname, "favicon_io", "favicon.ico")));
app.use("/dist", express.static("dist"));
app.use("/favicon_io", express.static("favicon_io"));
app.use(express.static("assets"));
app.get("/", (_req, res) => res.sendFile(path.join(__dirname, "index.html")));
app.use('/api/orders', require('./routes/orders'));
app.use('/api/sessions', require('./routes/sessions'));
app.use('/api/products', require('./routes/products'));
app.use('/api/users', require('./routes/users'));
app.use('/api/stripe', require('./routes/stripe'));
app.use((err, _req, res, _next) => {
console.log(err);
res.status(err.status || 500).send({ error: err });
});
module.exports = app;