[client-sync] Make sure to attach route files ending in .es6 to local-api

Summary:
This prevented the /health endpoint from being available in the
local-api

Test Plan: manual

Reviewers: mark, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4280
This commit is contained in:
Juan Tejada 2017-03-28 16:25:28 -07:00
parent 9eabfa516f
commit ca50e6cf52
2 changed files with 2 additions and 11 deletions

View file

@ -122,21 +122,12 @@ class ThreadSearchIndexStore {
if (change.objectClass !== Thread.name) {
return;
}
_.defer(async () => {
_.defer(() => {
const {objects, type} = change
const threads = objects;
let promises = []
if (type === 'persist') {
const alreadyIndexedThreads = threads.filter(t => t.isSearchIndexed)
if (alreadyIndexedThreads.length > 0) {
alreadyIndexedThreads.forEach(thread => {
// Mark already indexed threads as unindexed so that we re-index them
// with updates
thread.isSearchIndexed = false
})
await DatabaseStore.inTransaction(t => t.persistModels(alreadyIndexedThreads))
}
this.indexer.notifyHasIndexingToDo();
} else if (type === 'unpersist') {
promises = threads.map(thread => this.unindexThread(thread,

View file

@ -71,7 +71,7 @@ const validate = (request, username, password, callback) => {
const attach = (directory) => {
const routesDir = path.join(__dirname, directory)
fs.readdirSync(routesDir).forEach((filename) => {
if (filename.endsWith('.js')) {
if (filename.endsWith('.js') || filename.endsWith('.es6')) {
const routeFactory = require(path.join(routesDir, filename));
routeFactory(server);
}