No apiConfig defined on module 'app'. Are you missing a module.exports?
See original GitHub issueWith the following, which sits inside a folder api/app.js
, in the package.json file for the project I have "files": "api/*.js
/*global require, module*/
var APIBuilder = require('claudia-api-builder');
var api = new APIBuilder();
var Promise = require('bluebird');
var pg = require('pg');
module.exports = api;
api.get('/app', function() {
return new Promise(function(resolve, reject) {
var client = new pg.Client('<connection string>');
client.connect(function(error) {
if (error) {
return reject(error);
}
client.query('SELECT * FROM apps', function(error, results) {
if (error) {
return reject(error);
}
var output = results.map(function(result) {
return {
// Map return in here
}
});
return resolve(output);
});
})
});
});
I get the error in the title after running:
claudia create --name appname --region eu-west-1 --api-module app
The full output is:
server listening on port: 4001
No apiConfig defined on module 'app'. Are you missing a module.exports?
No claudia.json
file is created either
I’ve tried to follow the example as close as possible, although this code lives in an existing project that is a static app, and rather than have a separate repo I am keeping the lamda functions within the api folder to deploy.
Any ideas?
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
node.js - TypeError: Cannot read properties of undefined ...
currentweather.js exports a function which returns an instance of Sequelize's CurrentWeather , while you're trying to act as if the function ...
Read more >foreverjs/forever - Gitter
What is the error that you are getting? ... (node:733992) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
Read more >How to Develop a Boilerplate for API with Node.js, Express ...
Now we are set and ready for Express API boilerplate development. ... api routes v1 app.use('/api/v1', api(config)); module.exports = app;.
Read more >node-api-auth - npm Package Health Analysis - Snyk
You can define routes by adding new files in the api/routes folder, for example: "use strict"; module.exports = function ( app, ...
Read more >reste - npm
exports. ... (If your Titanium app does not use node modules already, ... now we can do our one-time configure api.config({ debug: true, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
this is now available on NPM as 1.1.0. I’ve made the new version fully backwards compatible, so there was no need to bump major version.
I’ve never tried to create a lambda with a function in a subfolder; this might be a limitation of the lambda nodejs engine, not sure. I’ll investigate that.