1 | /**
|
2 | * Copyright (c) 2015-present, Facebook, Inc.
|
3 | *
|
4 | * This source code is licensed under the MIT license found in the
|
5 | * LICENSE file in the root directory of this source tree.
|
6 | */
|
7 | ;
|
8 |
|
9 | const launchEditor = require('./launchEditor');
|
10 | const launchEditorEndpoint = require('./launchEditorEndpoint');
|
11 |
|
12 | module.exports = function createLaunchEditorMiddleware() {
|
13 | return function launchEditorMiddleware(req, res, next) {
|
14 | if (req.url.startsWith(launchEditorEndpoint)) {
|
15 | launchEditor(req.query.fileName, req.query.lineNumber);
|
16 | res.end();
|
17 | } else {
|
18 | next();
|
19 | }
|
20 | };
|
21 | };
|