Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'atlassian-connect-express' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
import http from 'http';
import express from 'express';
import AtlasConnectExpress from 'atlassian-connect-express';
import bodyParser from 'body-parser';
import helmet from 'helmet';
import addMiddleware from './middleware';
import addRoutes from './routes';
import createServer from './server';
// create express application
const app = express();
// secure your app with helmet defaults at least
app.use(helmet());
app.set('env', process.env.ENVIRONMENT); // atlas-connect-express needs this
// get atlas-connect addon instance
const ace = AtlasConnectExpress(app);
// add default atlas-connect middleware
app.use(ace.middleware());
// add body-parser middleware
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
// add application middleware
addMiddleware(app, ace);
// add routes defined in ./routes. Pass addon for authentication and jira api requests
addRoutes(app, ace);
// create graphql server
const server = createServer(app);
const httpServer = http.createServer(app);
server.installSubscriptionHandlers(httpServer);
// start the server
const PORT = process.env.API_PORT || 3000;
httpServer.listen({ port: PORT }, () => {