I have a proof of concept project <https://github.com/danizavtz>, u can follow to use in your rest api.
there is an express app that only handles json. On 1 August 2017 at 11:29, InfantJoseph S <[email protected]> wrote: > Am a newbie here. I want to develop a NodeJS application which serves only > to expose REST APIs. My application have nothing to do with View. I used > Express generator to generate a project and I removed the views folder. > Also I changed the package.json 'start' from 'node bin/www' to 'node > app.js'. But it didn't worked. > > How can I structure my project so that it will initialise with routes and > my APIs will be exposed. > > I got a suggestion to use 'Swagger', but I need to work with .yaml file > and didn't want my team to do considering future dependencies. Thanks for > the help in advance. > > *app.js* > > *var express = require('express');* > *var bodyParser = require('body-parser');* > *var contoller = require('./domains/apply/controller');* > > *var app = express();* > *app.use(bodyParser.json());* > > *app.post('/email', (req, res) => {* > * console.log(req.body.address);* > * res.json({ ok: true });* > *});* > > *app.listen(4443, () => console.log('Listening on http://localhost:4443/') > <http://localhost:4443/')>);* > > > > *controller.js* > > *app.get('/employee', function(req, res){* > * "use strict";* > * console.log(" employee ---- "+req);* > * res.json({ ok: true });* > *});* > > -- > Job board: http://jobs.nodejs.org/ > New group rules: https://gist.github.com/othiym23/9886289#file- > moderation-policy-md > Old group rules: https://github.com/joyent/node/wiki/Mailing-List- > Posting-Guidelines > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/nodejs/99c3bb5e-50cb-4bb4-9060-b2abd4a0d34c%40googlegroups.com > <https://groups.google.com/d/msgid/nodejs/99c3bb5e-50cb-4bb4-9060-b2abd4a0d34c%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- []'s -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAET7tnauA-gxsnxLufZwhx-ZydgemNkVYNSHpDTkvVp3dvr2Sw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
