forked from VickScarlet/lifeRestart
-
Notifications
You must be signed in to change notification settings - Fork 10
/
sls.js
50 lines (39 loc) · 929 Bytes
/
sls.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const express = require("express");
const app = express();
// Routes
app.use(express.static('./'));
app.get(`/`, (req, res) => {
res.redirect("./view/index.html");
});
/* app.get(`/`, (req, res) => {
res.sendFile(path.join(__dirname, 'index.html'));
});
app.get('/user', (req, res) => {
res.send([
{
title: 'serverless framework',
link: 'https://serverless.com',
},
]);
});
app.get('/user/:id', (req, res) => {
const id = req.params.id;
res.send({
id: id,
title: 'serverless framework',
link: 'https://serverless.com',
});
}); */
app.get('/404', (req, res) => {
res.status(404).send('Not found');
});
app.get('/500', (req, res) => {
res.status(500).send('Server Error');
});
// Error handler
app.use(function (err, req, res, next) {
console.error(err);
res.status(500).send('Internal Serverless Error');
});
app.binaryTypes = ["font/woff2"];
module.exports = app;