Last active
December 1, 2018 08:12
-
-
Save ekristen/9562179 to your computer and use it in GitHub Desktop.
Example Integration of Restify Endpoints
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var restify = require('restify'); | |
var restify_endpoints = require('restify-endpoints'); | |
var endpoints = new restify_endpoints.EndpointManager({ | |
endpointpath: __dirname + '/endpoints' | |
}); | |
// Create the RESTful Server | |
var server = restify.createServer(); | |
server.use(restify.acceptParser(server.acceptable)); | |
server.use(restify.authorizationParser()); | |
server.use(restify.dateParser()); | |
server.use(restify.queryParser()); | |
server.use(restify.jsonp()); | |
server.use(restify.gzipResponse()); | |
server.use(restify.bodyParser()); | |
server.use(restify.conditionalRequest()); | |
// Attach Restify Endpoints to RESTify server | |
endpoints.attach(server); | |
server.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment