So now that we've created the data in our database the next step is to create our server.
So we're going back from database to server to client.
So in order to do this there's a number of steps which are pretty much boilerplate.
It's what you're going to do every time when you set up a new server that uses MongoDB.
And we've really done it plenty of times before
so I'm going to set this to you as a challenge.
So the first thing you have to do is to create a new directory called Wiki-API and then we're going
to initialize NPM and install 4 packages: body-parser, mongoose, ejs and express. And then we're
going to create a new file called app.js and inside app.js we're going to add our server code.
So that includes requiring all those modules that we installed and initializing express and setting
body-parser up.
Now this is something that you need to do every single time.
And if you prefer instead of writing it all now you can also go to that repository at github.com
/londonappbrewery/
Build-Your-Own-RESTful-API and then if you scroll down you can see that there's some service starting
code that I have put there for you which you can copy and paste into your app.js.
Now alternatively some students prefer to get extra practice and they try and write it all out.
So it's completely up to you which method you want to go down.
And once you've set up your server then the next step is to setup MongoDB and our database name as
you remember is called wikiDB and the collection that it contains is called articles and all the
documents in the article collection has two fields: title and content. So using all of that information
you should be able to set up a connection with MongoDB and be able to create the models that you
need with Mongoose and be able to set it up. So give that a go and if you get stuck or if you have any
problems head back over here and I'll walk you through the entire process.