Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'use strict';
require('dotenv').config();
const express = require('express');
const Logger = require('logdna');
const app = express();
const cors = require('cors');
const bodyParser = require('body-parser');
const options = {
hostname: 'your-host-name',
ip: 'your-ip-address',
mac: 'your-mac-address',
app: 'name-of-your-app',
};
const log = Logger.setupDefaultLogger(process.env.key, options);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cors());
app.get('/api/test', (req, res) => {
res.json({ message: "Test that the URL is working" });
});
app.post('/api/log', (req, res) => {
log.info(`Application Name: ${req.body.app_name}`);
log.info(`Application Description: ${req.body.app_description}`);
console.log("Log something now");
res.json({ message: "Logged something successfully" });
});
app.listen(7777);
console.log('Listening on localhost:7777');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.