Update app.js
Browse files
app.js
CHANGED
@@ -56,12 +56,13 @@ const utils = {
|
|
56 |
const app = express();
|
57 |
app.use(express.json());
|
58 |
app.use(cors());
|
|
|
59 |
|
60 |
app.get('*', async (req, res) => {
|
61 |
try {
|
62 |
const { q } = req.query;
|
63 |
if (!q) {
|
64 |
-
return res.json({
|
65 |
name: 'HD Bart Generator API',
|
66 |
message: 'Parameter q di perlukan',
|
67 |
version: '2.1.0',
|
@@ -98,4 +99,4 @@ app.listen(PORT, async () => {
|
|
98 |
process.on('SIGINT', async () => {
|
99 |
await utils.close();
|
100 |
process.exit(0);
|
101 |
-
});
|
|
|
56 |
const app = express();
|
57 |
app.use(express.json());
|
58 |
app.use(cors());
|
59 |
+
app.set('json spaces', 4); // Pretty print JSON secara global
|
60 |
|
61 |
app.get('*', async (req, res) => {
|
62 |
try {
|
63 |
const { q } = req.query;
|
64 |
if (!q) {
|
65 |
+
return res.status(200).json({
|
66 |
name: 'HD Bart Generator API',
|
67 |
message: 'Parameter q di perlukan',
|
68 |
version: '2.1.0',
|
|
|
99 |
process.on('SIGINT', async () => {
|
100 |
await utils.close();
|
101 |
process.exit(0);
|
102 |
+
});
|